Beispiel #1
0
 public static Func <IWebDriver, IWebElement> ElementIsVisible(By locator)
 {
     return((Func <IWebDriver, IWebElement>)(driver =>
     {
         try
         {
             return ExpectedConditions.ElementIfVisible(driver.FindElement(locator));
         }
         catch (StaleElementReferenceException ex)
         {
             return (IWebElement)null;
         }
     }));
 }
Beispiel #2
0
 public static Func <IWebDriver, IWebElement> ElementToBeClickable(By locator)
 {
     return((Func <IWebDriver, IWebElement>)(driver =>
     {
         IWebElement webElement = ExpectedConditions.ElementIfVisible(driver.FindElement(locator));
         try
         {
             if (webElement != null && webElement.Enabled)
             {
                 return webElement;
             }
             return (IWebElement)null;
         }
         catch (StaleElementReferenceException ex)
         {
             return (IWebElement)null;
         }
     }));
 }