diff --git a/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/BasePageObject.java b/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/BasePageObject.java index d341dae5..c8aee4f7 100644 --- a/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/BasePageObject.java +++ b/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/BasePageObject.java @@ -152,6 +152,16 @@ protected boolean isElementPresent(WebElement element) { return pageHelper.isElementPresent(element); } + /** + * Check to see if the element is visible or not. + * + * @param element WebElement to search for + * @return found or not + */ + protected boolean isElementVisible(WebElement element) { + return pageHelper.isElementVisible(element); + } + /** * Check to see if the element is on the page or not. * @@ -302,6 +312,20 @@ public void waitForElementToClickable(WebElement webElement, int timeOutInSecond pageHelper.waitForElementToClickable(webElement, timeOutInSeconds); } + /** + * Wait and click the element. + * + * Ignore {@link WebDriverException}. When a DOM operation is happening on a page it may + * temporarily cause the element to be inaccessible. Ignore these hierarchy of Exceptions. + * + * @param webElement Can click the element. + * @param timeOutInSeconds Timeout in Seconds. + * + */ + public void waitAndClickElement(WebElement webElement, int timeOutInSeconds) { + pageHelper.waitAndClickElement(webElement, timeOutInSeconds); + } + /** * Find the first visible element in a list. * diff --git a/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/PageHelper.java b/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/PageHelper.java index ef39a1ff..62c1b977 100644 --- a/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/PageHelper.java +++ b/cubano-webdriver/src/main/java/org/concordion/cubano/driver/web/PageHelper.java @@ -317,7 +317,7 @@ public void waitForElementToClickable(WebElement webElement, int timeOutInSecond * @param timeOutInSeconds Timeout in Seconds. * */ - private void waitAndClickElement(WebElement element, int timeoutSeconds) { + protected void waitAndClickElement(WebElement element, int timeoutSeconds) { new WebDriverWait(this.pageObject.getBrowser().getDriver(), timeoutSeconds).ignoring(WebDriverException.class) .until((WebDriver d) -> {