public bool ElementExists(IWebElement element) { try { EstaticWait.Until(d => d.FindElement(By.TagName(element.TagName))); return(true); } catch (TimeoutException) { return(false); } }
public void FillElement(IWebElement element, string input) { if (EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(element)).Enabled) { element.Clear(); element.SendKeys(input); } else { throw new Exception("Element was not visible and couldn't be selected."); } }
public bool WaitUntilJSReady() { var jsExec = (IJavaScriptExecutor)driver; //Wait for Javascript to load bool jsLoad(IWebDriver drivers) => ((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").ToString().Equals("complete"); //Get JS is Ready bool jsReady = (Boolean)jsExec.ExecuteScript("return document.readyState").ToString().Equals("complete"); //Wait Javascript until it is Ready! if (!jsReady) { //Wait for Javascript to load jsReady = EstaticWait.Until(jsLoad); } return(jsReady); }
public void WatiForLoadScrean() { EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath(".//div[contains(@class, 'dx-loadindicator')]"))); }
public bool ElementPresence(IWebElement element) { return(EstaticWait.Until(d => element.Displayed)); }
public void ClickOnElement_Javascript(IWebElement element) { ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(element))); }
public void ClickOnElement(IWebElement element) { EstaticWait.Until(d => !(SeleniumExtras.WaitHelpers.ExpectedConditions.StalenessOf(element)(d))); EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(element)).Click(); }