コード例 #1
0
 public static IWebElement FindElementByjQueryWait(this IWebDriver driver, FindBy.jQueryBy by, int timeoutInSeconds = 10)
 {
     if (timeoutInSeconds > 0)
     {
         var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
         wait.Until(d => d.FindElementByjQuery(by));
     }
     return(driver.FindElementByjQuery(by));
 }
コード例 #2
0
        public static IWebElement FindElementByjQuery(this IWebDriver driver, FindBy.jQueryBy by)
        {
            IWebElement element = driver.ExecuteJavaScript("return " + by.Selector + ".get(0)") as IWebElement;

            if (element != null)
            {
                return(element);
            }
            else
            {
                throw new NoSuchElementException("No element found with jQuery command: jQuery" + by.Selector);
            }
        }