1111import java .io .File ;
1212import java .io .IOException ;
1313import java .text .SimpleDateFormat ;
14+ import java .time .Duration ;
1415import java .util .ArrayList ;
1516import java .util .Date ;
1617import java .util .List ;
@@ -113,8 +114,8 @@ public static void waitFor(int seconds) {
113114 * @return
114115 */
115116 public static WebElement waitForVisibility (WebElement element , int timeToWaitInSec ) {
116- WebDriverWait wait = new WebDriverWait (Driver .get (), timeToWaitInSec );
117- // WebDriverWait wait = new WebDriverWait(Driver.get(), Duration.ofSeconds(20));
117+ // WebDriverWait wait = new WebDriverWait(Driver.get(), timeToWaitInSec);
118+ WebDriverWait wait = new WebDriverWait (Driver .get (), Duration .ofSeconds (20 ));
118119 return wait .until (ExpectedConditions .visibilityOf (element ));
119120 }
120121
@@ -126,8 +127,8 @@ public static WebElement waitForVisibility(WebElement element, int timeToWaitInS
126127 * @return
127128 */
128129 public static WebElement waitForVisibility (By locator , int timeout ) {
129- WebDriverWait wait = new WebDriverWait (Driver .get (), timeout );
130- // WebDriverWait wait = new WebDriverWait(Driver.get(), Duration.ofSeconds(20));
130+ // WebDriverWait wait = new WebDriverWait(Driver.get(), timeout);
131+ WebDriverWait wait = new WebDriverWait (Driver .get (), Duration .ofSeconds (20 ));
131132 return wait .until (ExpectedConditions .visibilityOfElementLocated (locator ));
132133 }
133134
@@ -139,8 +140,8 @@ public static WebElement waitForVisibility(By locator, int timeout) {
139140 * @return
140141 */
141142 public static WebElement waitForClickablility (WebElement element , int timeout ) {
142- WebDriverWait wait = new WebDriverWait (Driver .get (), timeout );
143- // WebDriverWait wait = new WebDriverWait(Driver.get(), Duration.ofSeconds(20));
143+ // WebDriverWait wait = new WebDriverWait(Driver.get(), timeout);
144+ WebDriverWait wait = new WebDriverWait (Driver .get (), Duration .ofSeconds (20 ));
144145 return wait .until (ExpectedConditions .elementToBeClickable (element ));
145146 }
146147
@@ -152,8 +153,8 @@ public static WebElement waitForClickablility(WebElement element, int timeout) {
152153 * @return
153154 */
154155 public static WebElement waitForClickablility (By locator , int timeout ) {
155- WebDriverWait wait = new WebDriverWait (Driver .get (), timeout );
156- // WebDriverWait wait = new WebDriverWait(Driver.get(), Duration.ofSeconds(20));
156+ // WebDriverWait wait = new WebDriverWait(Driver.get(), timeout);
157+ WebDriverWait wait = new WebDriverWait (Driver .get (), Duration .ofSeconds (20 ));
157158 return wait .until (ExpectedConditions .elementToBeClickable (locator ));
158159 }
159160
@@ -169,8 +170,8 @@ public Boolean apply(WebDriver driver) {
169170 }
170171 };
171172 try {
172- // WebDriverWait wait = new WebDriverWait(Driver.get(), Duration.ofSeconds(20));
173- WebDriverWait wait = new WebDriverWait (Driver .get (), timeOutInSeconds );
173+ WebDriverWait wait = new WebDriverWait (Driver .get (), Duration .ofSeconds (20 ));
174+ // WebDriverWait wait = new WebDriverWait(Driver.get(), timeOutInSeconds);
174175 wait .until (expectation );
175176 } catch (Throwable error ) {
176177 error .printStackTrace ();
@@ -400,8 +401,8 @@ public static void clickWithWait(By by, int attempts) {
400401 * @param time
401402 */
402403 public static void waitForPresenceOfElement (By by , long time ) {
403- new WebDriverWait (Driver .get (), time ).until (ExpectedConditions .presenceOfElementLocated (by ));
404- // WebDriverWait wait = new WebDriverWait(Driver.get(), Duration.ofSeconds(20));
404+ // new WebDriverWait(Driver.get(), time).until(ExpectedConditions.presenceOfElementLocated(by));
405+ WebDriverWait wait = new WebDriverWait (Driver .get (), Duration .ofSeconds (20 ));
405406 //wait.until(ExpectedConditions.presenceOfElementLocated(by));
406407 }
407408
0 commit comments