Created
May 21, 2020 08:36
-
-
Save seleniumgists/dc0e3182908f1fdc63c511cbda38eb6f to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected static WebElement getElement(By locator) { | |
| try { | |
| WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(Constants.MAX_WAIT_SECONDS_EXPLICIT)); | |
| wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); | |
| } catch (Exception tex) { | |
| logOutput("FAIL", tex.getMessage()); | |
| } | |
| if (!driver.findElements(locator).isEmpty()) { | |
| return driver.findElements(locator).get(0); | |
| } else { | |
| logOutput("FAIL", "Could not find object - " + locator.toString()); | |
| return null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment