Inheritance: WebDriverException
Ejemplo n.º 1
0
        public static int logCatchElementNotFound(int attemptNumber, OpenQA.Selenium.NoSuchElementException e, string elementName)
        {
            // sleep to let the page finish loading
            Thread.Sleep(100);
            logger.Debug("HTML Element " + elementName + " not found, attempt number: " + attemptNumber);
            logger.Error(e.Message);
            logger.Error(e.StackTrace);

            // check if max retries were made
            if (attemptNumber > maxRetryAttempts)
            {
                throw new OpenQA.Selenium.NoSuchElementException("Max retry was reached!!!");
            }

            return(++attemptNumber);
        }
 public static void ThrowShouldBeAssignableToException(string reason)
 {
     var err = new NoSuchElementException();
     err.Should().BeAssignableTo<ExpectedConditions>(reason);
 }
        /// <summary>
        ///     Custom wait handler
        /// </summary>
        public static void WaitForElement(string _string)
        {
            if (Wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(_string))) != null) return;

            var reason = "Element: {" + _string + "} is not visible or loaded on " + CurrentPage().Url;
            var ex = new NoSuchElementException();
            //ex.Should().BeAssignableTo<ExpectedConditions>(@reason);
        }