Created
March 23, 2017 14:58
-
-
Save tourdedave/e19109c5b5a26a39602bf3ccee512ad1 to your computer and use it in GitHub Desktop.
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
// in Base Page Object | |
public Boolean isDisplayed(By locator) { | |
try { | |
return find(locator).isDisplayed(); | |
} catch (org.openqa.selenium.NoSuchElementException exception) { | |
return false; | |
} | |
} | |
public Boolean isDisplayed(By locator, Integer timeout) { | |
try { | |
WebDriverWait wait = new WebDriverWait(driver, timeout); | |
wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); | |
} catch (org.openqa.selenium.TimeoutException exception) { | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment