@Test void isEnabledShouldThrowIfTheElementIsNotVisible() { final WebElement mockedElement = mock(WebElement.class); when(mockedDriver.findElement(By.name("foo"))) .thenReturn(mockedElement); when(mockedElement.isEnabled()) .thenThrow(ElementNotVisibleException.class); assertThrows(ElementNotVisibleException.class, () -> driver.findElement(By.name("foo")).isEnabled()); assertThat(clock.now(), is(1000L)); verify(mockedDriver, times(1)).findElement(By.name("foo")); verify(mockedElement, times(11)).isEnabled(); }
@Override public WebElement findElement(By locator) { try { return new ImplicitlyWaitingWebElement(trier().tryTo(getOriginal()::findElement, locator), this).getActivated(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { throw propagate(e.getCause()); } }
ImplicitlyWaitingWebDriver extends DecoratedWebDriver { @Override public WebElement findElement(By locator) { try { return new ImplicitlyWaitingWebElement(trier().tryTo(getOriginal()::findElement, locator), this).getActivated(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { throw propagate(e.getCause()); } } }
ImplicitlyWaitingWebDriver extends DecoratedWebDriver { @Override public WebElement findElement(By locator) { try { return new ImplicitlyWaitingWebElement(trier().tryTo(getOriginal()::findElement, locator), this).getActivated(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { throw propagate(e.getCause()); } } ImplicitlyWaitingWebDriver(final WebDriver driver);  ImplicitlyWaitingWebDriver(final WebDriver driver, long timeoutInSeconds);  ImplicitlyWaitingWebDriver(final WebDriver driver, long timeoutInSeconds, long sleepTimeOut); protected  ImplicitlyWaitingWebDriver(final WebDriver driver, Clock clock, Sleeper sleeper, long timeoutInSeconds, long sleepTimeOut); }
ImplicitlyWaitingWebDriver extends DecoratedWebDriver { @Override public WebElement findElement(By locator) { try { return new ImplicitlyWaitingWebElement(trier().tryTo(getOriginal()::findElement, locator), this).getActivated(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { throw propagate(e.getCause()); } } ImplicitlyWaitingWebDriver(final WebDriver driver);  ImplicitlyWaitingWebDriver(final WebDriver driver, long timeoutInSeconds);  ImplicitlyWaitingWebDriver(final WebDriver driver, long timeoutInSeconds, long sleepTimeOut); protected  ImplicitlyWaitingWebDriver(final WebDriver driver, Clock clock, Sleeper sleeper, long timeoutInSeconds, long sleepTimeOut); @Override WebElement findElement(By locator); @Override List<WebElement> findElements(By locator); }
ImplicitlyWaitingWebDriver extends DecoratedWebDriver { @Override public WebElement findElement(By locator) { try { return new ImplicitlyWaitingWebElement(trier().tryTo(getOriginal()::findElement, locator), this).getActivated(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { throw propagate(e.getCause()); } } ImplicitlyWaitingWebDriver(final WebDriver driver);  ImplicitlyWaitingWebDriver(final WebDriver driver, long timeoutInSeconds);  ImplicitlyWaitingWebDriver(final WebDriver driver, long timeoutInSeconds, long sleepTimeOut); protected  ImplicitlyWaitingWebDriver(final WebDriver driver, Clock clock, Sleeper sleeper, long timeoutInSeconds, long sleepTimeOut); @Override WebElement findElement(By locator); @Override List<WebElement> findElements(By locator);  }