public void test()
        {
            ClickMe.Click();
            string              text       = GetMethods.GetTextValue(GenerateText);
            SelectElement       selectList = new SelectElement(ddl);
            IList <IWebElement> options    = selectList.Options;

            for (int j = 2; j < options.Count; j++)
            {
                string optionText = options[j].Text.ToString();
                Console.WriteLine("{0} : {1}", text, optionText);
                if (text.Equals(optionText))
                {
                    SetMethods.SelectDropDown(ddl, optionText);
                    break;
                }
            }
            Submit.Click();
            Thread.Sleep(800);
            Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
            ClosePopUp.Click();
        }
Beispiel #2
0
 public void test()
 {
     GenerateBtn.Click();
     for (int i = 2; i < 7; i++)
     {
         IWebElement         letter     = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[2]/table/tr[" + i + "]/td[1]"));
         IWebElement         ddl        = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[2]/table/tr[" + i + "]/td[2]/select"));
         SelectElement       selectList = new SelectElement(ddl);
         IList <IWebElement> options    = selectList.Options;
         for (int j = 1; j < 6; j++)
         {
             string optionText = options[j].Text.ToString();
             if (CheckLetter(letter.Text).Equals(optionText.Substring(0, 1)))
             {
                 SetMethods.SelectDropDown(ddl, optionText);
                 break;
             }
         }
     }
     SubmitBtn.Click();
     Thread.Sleep(800);
     Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed");
     ClosePopUp.Click();
 }