try {
toReturn =
(WebElement) ((JavascriptExecutor) driver).executeScript(strategy, actualLocator);
if (toReturn == null) {
throw new SeleniumException("Element " + locator + " not found");
}
return toReturn;
} catch (WebDriverException e) {
throw new SeleniumException("Element " + locator + " not found");
}
}
try {
return findElementDirectly(driver, locator);
} catch (WebDriverException e) {
throw new SeleniumException("Element " + locator + " not found", e);
}
}