private void SetImageElement()
 {
     if (isGroup)
     {
         elemAddImage = driver.FindElement(OpenQA.Selenium.By.Name("composer_photo[]"), 10);
     }
     else
     {
         elemAddImage = driver.FindElement(OpenQA.Selenium.By.XPath("/html/body/div[1]/div[3]/div[1]/div/div[2]/div[2]/div[1]/div[2]/div/div[3]/div/div/div[2]/div/div/div/form/div[2]/span/div[1]/div/a/div[2]/input"), 10);
     }
 }
示例#2
0
 public static OpenQA.Selenium.IWebElement FindElement(
     this OpenQA.Selenium.IWebDriver driver,
     OpenQA.Selenium.By by,
     int timeoutInSeconds,
     bool waitForClickable = false)
 {
     if (timeoutInSeconds > 0)
     {
         var wait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
         wait.PollingInterval = TimeSpan.FromMilliseconds(500);
         wait.IgnoreExceptionTypes(typeof(OpenQA.Selenium.ElementNotInteractableException), typeof(OpenQA.Selenium.NoSuchElementException), typeof(OpenQA.Selenium.WebDriverTimeoutException));
         wait.Until(drv =>
         {
             var elemList = drv.FindElements(by);
             return((!waitForClickable && elemList.Count == 1) ||
                    (waitForClickable && elemList.Count == 1 && elemList[0].Displayed && elemList[0].Enabled));
         }
                    );
     }
     return(driver.FindElement(by));
 }
 private void SetUsername(string username)
 {
     elemUsername = driver.FindElement(OpenQA.Selenium.By.Id("email"));
     elemUsername.SendKeys(username);
 }