class 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("//" + PathOperators.not(el).getXPath().get()));
            } 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);
        }
    }

}