DecoratedWebElement extends DecoratedChild<WebElement,DecoratedWebDriver> implements WebElement, WrapsElement, Locatable { @Override public List<WebElement> findElements(final By by) { return getTopmostDecorated().wrapElements(getOriginal().findElements(by)); } DecoratedWebElement(final WebElement element, final DecoratedWebDriver driverWrapper); @Override final WebElement getWrappedElement(); @Override void click(); @Override void submit(); @Override void sendKeys(final CharSequence... keysToSend); @Override void clear(); @Override String getTagName(); @Override String getAttribute(final String name); @Override boolean isSelected(); @Override boolean isEnabled(); @Override String getText(); @Override List<WebElement> findElements(final By by); @Override WebElement findElement(final By by); @Override boolean isDisplayed(); @Override Point getLocation(); @Override Dimension getSize(); @Override Rectangle getRect(); @Override String getCssValue(final String propertyName); Coordinates getCoordinates(); @Override X getScreenshotAs(OutputType<X> outputType);  }
@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(); }