public static IWebElement FindElement(this IWebDriver driver, JQueryHelper.JQueryBy by, int timeOut = 10) { DefaultWait <IWebDriver> fluentWait = new DefaultWait <IWebDriver>(driver); fluentWait.Timeout = TimeSpan.FromSeconds(timeOut); fluentWait.PollingInterval = TimeSpan.FromMilliseconds(250); fluentWait.IgnoreExceptionTypes(typeof(NoSuchElementException)); fluentWait.Message = "Element : " + by.Selector + " to be searched not found"; return(fluentWait.Until(x => x.GetElement(by))); }
public static IWebElement GetElement(this IWebDriver driver, JQueryHelper.JQueryBy by) { ReadOnlyCollection <IWebElement> collection = ((IJavaScriptExecutor)driver).ExecuteScript("return jQuery" + by.Selector + ".get()") as ReadOnlyCollection <IWebElement>; if (collection == null) { return(null); } return(collection[0]); }