InBrowserFinder { static WebElement findPageWithout(WebDriver driver, final Path el) { if (!el.getXPath().isPresent()) { throw new UnsupportedOperationException("findPageWithout requires a path"); } final String path = el.getXPath().get(); try { if (el.getUnderlyingSource().isPresent()) { final WebElement underlying = el.getUnderlyingSource().get(); return underlying.findElement(By.xpath(" } else { String processedPath = XpathUtils.doesNotExistInEntirePage(path); return driver.findElement(By.xpath(processedPath)); } } catch (org.openqa.selenium.NoSuchElementException ex) { throw new NoSuchElementException("could not find page without " + el, ex); } }  static List<WebElement> findAll(WebDriver driver, final Path el); static WebElement findPageWithNumberOfOccurrences(WebDriver driver, final Path el, int numberOfOccurrences); static WebElement findPageWithNumberOfOccurrences(WebDriver driver, final Path el, int numberOfOccurrences, RelationOperator relationOperator);  }
@Test public void findWithout() { when(driverMock.findElement(By.xpath("/html[not(. assertThat(InBrowserFinder.findPageWithout(driverMock, BasicPath.div), is(equalTo(webElement2))); }
@Test public void findWithoutUnderlying() { when(webElement.findElement(By.xpath(" Path path = BasicPath.builder().withUnderlying(webElement).withXpath("div").build(); assertThat(InBrowserFinder.findPageWithout(driverMock, path), is(webElement2)); }