@Test void testFindElements() { Fixture fixture = new Fixture(); WebElement found = mock(WebElement.class); List<WebElement> list = new ArrayList<>(); list.add(found); when(fixture.mocked.findElements(By.id("test"))).thenReturn(list); List<WebElement> proxyList = fixture.decorated.findElements(By.id("test")); assertThat(list, sameInstance(proxyList)); assertThat(found, not(sameInstance(proxyList.get(0)))); verify(fixture.mocked, times(1)).findElements(By.id("test")); proxyList.get(0).isDisplayed(); verify(found, times(1)).isDisplayed(); }
@Override public List<WebElement> findElements(final By by) { return wrapElements(getOriginal().findElements(by)); }
DecoratedWebDriver extends DecoratedTopmost<WebDriver> implements WebDriver, WrapsDriver, JavascriptExecutor, HasInputDevices, HasTouchScreen, Interactive { @Override public List<WebElement> findElements(final By by) { return wrapElements(getOriginal().findElements(by)); } }
DecoratedWebDriver extends DecoratedTopmost<WebDriver> implements WebDriver, WrapsDriver, JavascriptExecutor, HasInputDevices, HasTouchScreen, Interactive { @Override public List<WebElement> findElements(final By by) { return wrapElements(getOriginal().findElements(by)); } DecoratedWebDriver(WebDriver driver); }
DecoratedWebDriver extends DecoratedTopmost<WebDriver> implements WebDriver, WrapsDriver, JavascriptExecutor, HasInputDevices, HasTouchScreen, Interactive { @Override public List<WebElement> findElements(final By by) { return wrapElements(getOriginal().findElements(by)); } DecoratedWebDriver(WebDriver driver); @Override final WebDriver getWrappedDriver(); @Override void get(String url); @Override String getCurrentUrl(); @Override String getTitle(); @Override WebElement findElement(final By by); @Override List<WebElement> findElements(final By by); @Override String getPageSource(); @Override void close(); @Override void quit(); @Override Set<String> getWindowHandles(); @Override String getWindowHandle(); @Override TargetLocator switchTo(); @Override Navigation navigate(); @Override Options manage(); @Override Object executeScript(String script, Object... args); @Override Object executeAsyncScript(String script, Object... args); @Override Keyboard getKeyboard(); @Override Mouse getMouse(); @Override TouchScreen getTouch(); @Override void perform(Collection<Sequence> actions); @Override void resetInputState(); }
DecoratedWebDriver extends DecoratedTopmost<WebDriver> implements WebDriver, WrapsDriver, JavascriptExecutor, HasInputDevices, HasTouchScreen, Interactive { @Override public List<WebElement> findElements(final By by) { return wrapElements(getOriginal().findElements(by)); } DecoratedWebDriver(WebDriver driver); @Override final WebDriver getWrappedDriver(); @Override void get(String url); @Override String getCurrentUrl(); @Override String getTitle(); @Override WebElement findElement(final By by); @Override List<WebElement> findElements(final By by); @Override String getPageSource(); @Override void close(); @Override void quit(); @Override Set<String> getWindowHandles(); @Override String getWindowHandle(); @Override TargetLocator switchTo(); @Override Navigation navigate(); @Override Options manage(); @Override Object executeScript(String script, Object... args); @Override Object executeAsyncScript(String script, Object... args); @Override Keyboard getKeyboard(); @Override Mouse getMouse(); @Override TouchScreen getTouch(); @Override void perform(Collection<Sequence> actions); @Override void resetInputState();  }