Пример #1
0
 public bool ElementExists(IWebElement element)
 {
     try
     {
         EstaticWait.Until(d => d.FindElement(By.TagName(element.TagName)));
         return(true);
     }
     catch (TimeoutException)
     {
         return(false);
     }
 }
Пример #2
0
 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.");
     }
 }
Пример #3
0
        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);
        }
Пример #4
0
 public void WatiForLoadScrean()
 {
     EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath(".//div[contains(@class, 'dx-loadindicator')]")));
 }
Пример #5
0
 public bool ElementPresence(IWebElement element)
 {
     return(EstaticWait.Until(d => element.Displayed));
 }
Пример #6
0
 public void ClickOnElement_Javascript(IWebElement element)
 {
     ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(element)));
 }
Пример #7
0
 public void ClickOnElement(IWebElement element)
 {
     EstaticWait.Until(d => !(SeleniumExtras.WaitHelpers.ExpectedConditions.StalenessOf(element)(d)));
     EstaticWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(element)).Click();
 }