Exemple #1
0
 protected IWebElement InternalFinder(By locator)
 {
     try
     {
         return(SmartWait.WaitFor(Driver, ElementToBeEnabled(locator),
                                  TimeOutSeconds, TimeOutInMillis));
     }
     catch (TimeoutException)
     {
         throw new Exception(
                   $"WebDriverTimeoutException: Element {locator} was not found for {TimeOutSeconds} seconds");
     }
 }
 private IWebElement InternalFinder(By locator)
 {
     try
     {
         return(SmartWait.WaitFor(Driver, ExpectedConditions.ElementIsVisible(locator),
                                  TimeOutSeconds, TimeOutInMillis));
     }
     catch (Exception)
     {
         throw new Exception(
                   $"WebDriverTimeoutException: Element {locator} was not found for {TimeOutSeconds} seconds");
     }
 }
        public ReadOnlyCollection <IWebElement> FindElements(By selector, ElementStates elementState, TimeSpan?timeout = null)
        {
            var foundElements  = new List <IWebElement>();
            var resultElements = new List <IWebElement>();

            try
            {
                SmartWait.WaitFor(driver =>
                {
                    foundElements  = driver.FindElements(selector).ToList();
                    resultElements = foundElements.Where(elementState.ElementStateCondition).ToList();
                    return(resultElements.Any());
                }, timeout);
            }
            catch (WebDriverTimeoutException ex)
            {
                HandleTimeoutException(ex, elementState, selector, foundElements);
            }
            return(resultElements.AsReadOnly());
        }
Exemple #4
0
 public static void WaitForPageLoaded(this IWebDriver driver)
 {
     SmartWait.WaitFor(driver,
                       b => ((IJavaScriptExecutor)b).ExecuteScript("return document.readyState").Equals("complete"),
                       JsonReader.GetPageLoadTimeOutInSeconds());
 }
Exemple #5
0
 private void WaitForCondition <T>(Func <IWebDriver, T> condition)
 {
     SmartWait.WaitFor(Driver, condition, TimeOutSeconds, TimeOutInMillis);
 }
 public void WaitForDisplayed()
 {
     SmartWait.WaitFor(d => IsDisplayed());
 }
Exemple #7
0
 public bool WaitForDisplayed()
 {
     return(SmartWait.WaitFor(d => FormLabel.FindElements(formSelector, ElementState.Displayed).Any()));
 }