@Test void findElementsShouldReturnEmptyListIfNoElementIsFound() { when(mockedDriver.findElements(By.name("foo"))) .thenReturn(new ArrayList<>()); List<WebElement> elements = driver.findElements(By.name("foo")); assertThat(clock.now(), is(1000L)); verify(mockedDriver, times(11)).findElements(By.name("foo")); assertThat(elements.size(), is(0)); }
@Override public List<WebElement> findElements(By locator) { try { return wrapElements(trier().tryTo(getOriginal()::findElements, locator)); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { return new ArrayList<>(); } }
ImplicitlyWaitingWebDriver extends DecoratedWebDriver { @Override public List<WebElement> findElements(By locator) { try { return wrapElements(trier().tryTo(getOriginal()::findElements, locator)); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { return new ArrayList<>(); } } }
ImplicitlyWaitingWebDriver extends DecoratedWebDriver { @Override public List<WebElement> findElements(By locator) { try { return wrapElements(trier().tryTo(getOriginal()::findElements, locator)); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { return new ArrayList<>(); } } 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 List<WebElement> findElements(By locator) { try { return wrapElements(trier().tryTo(getOriginal()::findElements, locator)); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { return new ArrayList<>(); } } 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 List<WebElement> findElements(By locator) { try { return wrapElements(trier().tryTo(getOriginal()::findElements, locator)); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (LimitExceededException e) { return new ArrayList<>(); } } 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);  }