@Test void findElementShouldThrowIfElementIsNotFound() { when(mockedDriver.findElement(By.name("foo"))) .thenThrow(NoSuchElementException.class); assertThrows(NoSuchElementException.class, () -> driver.findElement(By.name("foo"))); assertThat(clock.now(), is(1000L)); verify(mockedDriver, times(11)).findElement(By.name("foo")); }
@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);  }