SelectOption() public method

public SelectOption ( By by, string opttext ) : bool
by OpenQA.Selenium.By
opttext string
return bool
Exemplo n.º 1
0
        public void SeActivity_test_record_limit()
        {
            // Arrange
            int count = frb.ToServ <IActivityService>().GetAll().Count();

            while (count < 100)
            {
                var _activity = (Domain.Activity)Records.activity.Clone();
                frb.ToServ <IActivityService>().Create(_activity, "ME");
                count = frb.ToServ <IActivityService>().GetAll().Count();
            }

            // Act
            ui.WaitThenClickElement(By.Id("menulinkactivity"));

            // Test default
            ui.WaitForText("Showing (1 to 10)");
            //Thread.Sleep(3000); //prevent race condition
            int recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;

            Assert.AreEqual(recCount, 10, "Default record limiter is not set to 10");

            // Test 25
            ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "25");
            Thread.Sleep(1000); //prevent race condition
            recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;
            Assert.AreEqual(recCount, 25, "Record limiter set to 25 is not working");

            // Test 50
            ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "50");
            Thread.Sleep(1000); //prevent race condition
            recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;
            Assert.AreEqual(recCount, 50, "Record limiter set to 50 is not working");

            // Test 100
            ui.SelectOption(By.XPath("//*[@id='activityTable_length']/label/select"), "100");
            Thread.Sleep(1000); //prevent race condition
            recCount = ui._d.FindElements(By.XPath("//table[@id='activityTable']/tbody/tr")).Count;
            Assert.AreEqual(recCount, 100, "Record limiter set to 100 is not working");
        }