Commit 92072504 authored by holivier's avatar holivier

waitUntilElementNotVisible: add a new method to be able to call it with

a webElement, to avoid to do one more find and fail on not found
parent f0bb0595
...@@ -783,7 +783,7 @@ public class SimpleTestSuite { ...@@ -783,7 +783,7 @@ public class SimpleTestSuite {
try { try {
WebElement loaderWrapper = loaderWrappers.get(0); WebElement loaderWrapper = loaderWrappers.get(0);
if (loaderWrapper != null && loaderWrapper.isDisplayed()) { if (loaderWrapper != null && loaderWrapper.isDisplayed()) {
waitUntilElementNotVisible(By.id("loader-wrapper")); waitUntilElementNotVisible(loaderWrapper);
} }
} catch (StaleElementReferenceException stalExcp) { } catch (StaleElementReferenceException stalExcp) {
// do nothing because it's no more present // do nothing because it's no more present
...@@ -1253,9 +1253,12 @@ public class SimpleTestSuite { ...@@ -1253,9 +1253,12 @@ public class SimpleTestSuite {
} }
public void waitUntilElementNotVisible(By by) { public void waitUntilElementNotVisible(By by) {
waitUntilElementNotVisible(driver.findElement(by));
}
public void waitUntilElementNotVisible(WebElement we) {
try { try {
driverWait.until(ExpectedConditions.not(ExpectedConditions driverWait.until(ExpectedConditions.not(ExpectedConditions
.visibilityOf(driver.findElement(by)))); .visibilityOf(we)));
} catch (StaleElementReferenceException e) { } catch (StaleElementReferenceException e) {
// if element is "stale" it no more exist so it's not visible // if element is "stale" it no more exist so it's not visible
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment