Skip to content

Commit f6044f1

Browse files
committed
Improve some wait methods
1 parent 980430f commit f6044f1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/main/java/Utilities/Wait.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111

1212
public class Wait {
1313

14-
private static WebDriverWait webDriverWait;
15-
1614
private static void until(WebDriver webDriver, Long timeOutInSeconds, Function<WebDriver, Boolean> waitCondition) {
17-
webDriverWait = new WebDriverWait(webDriver, timeOutInSeconds);
15+
WebDriverWait webDriverWait = new WebDriverWait(webDriver, timeOutInSeconds);
1816
try {
1917
webDriverWait.until(waitCondition);
2018
} catch (Exception e) {
@@ -43,12 +41,10 @@ public static void untilPageReadyState(WebDriver webDriver, Long timeOutInSecond
4341
}
4442

4543
public static void untilElementIsVisible(WebDriver webDriver, WebElement webElement, Long timeOutInSeconds) {
46-
webDriverWait = new WebDriverWait(webDriver, timeOutInSeconds);
47-
webDriverWait.until(ExpectedConditions.visibilityOf(webElement));
44+
new WebDriverWait(webDriver, timeOutInSeconds).until(ExpectedConditions.visibilityOf(webElement));
4845
}
4946

5047
public static void untilListElementIsVisible(WebDriver webDriver, List<WebElement> webElements, Long timeOutInSeconds) {
51-
webDriverWait = new WebDriverWait(webDriver, timeOutInSeconds);
52-
webDriverWait.until(ExpectedConditions.visibilityOfAllElements(webElements));
48+
new WebDriverWait(webDriver, timeOutInSeconds).until(ExpectedConditions.visibilityOfAllElements(webElements));
5349
}
5450
}

0 commit comments

Comments
 (0)