2323import java .net .URISyntaxException ;
2424import java .net .URL ;
2525import java .nio .charset .Charset ;
26+ import java .time .Duration ;
2627import java .util .ArrayList ;
2728import java .util .Arrays ;
2829import java .util .Collections ;
@@ -1094,7 +1095,7 @@ protected final WebDriver loadPageVerifyTitle2(final String html, final String..
10941095 return verifyTitle2 (driver , expectedAlerts );
10951096 }
10961097
1097- protected final WebDriver verifyTitle2 (final long maxWaitTime , final WebDriver driver ,
1098+ protected final WebDriver verifyTitle2 (final Duration maxWaitTime , final WebDriver driver ,
10981099 final String ... expectedAlerts ) throws Exception {
10991100
11001101 final StringBuilder expected = new StringBuilder ();
@@ -1103,7 +1104,7 @@ protected final WebDriver verifyTitle2(final long maxWaitTime, final WebDriver d
11031104 }
11041105 final String expectedTitle = expected .toString ();
11051106
1106- final long maxWait = System .currentTimeMillis () + maxWaitTime ;
1107+ final long maxWait = System .currentTimeMillis () + maxWaitTime . toMillis () ;
11071108
11081109 while (System .currentTimeMillis () < maxWait ) {
11091110 try {
@@ -1200,9 +1201,9 @@ protected final WebDriver verifyJsVariable(final WebDriver driver, final String
12001201 return driver ;
12011202 }
12021203
1203- protected final WebDriver verifyWindowName2 (final long maxWaitTime , final WebDriver driver ,
1204+ protected final WebDriver verifyWindowName2 (final Duration maxWaitTime , final WebDriver driver ,
12041205 final String ... expectedAlerts ) throws Exception {
1205- final long maxWait = System .currentTimeMillis () + maxWaitTime ;
1206+ final long maxWait = System .currentTimeMillis () + maxWaitTime . toMillis () ;
12061207
12071208 while (System .currentTimeMillis () < maxWait ) {
12081209 try {
@@ -1245,7 +1246,7 @@ protected final WebDriver verifySessionStorage2(final WebDriver driver,
12451246 * @return the web driver
12461247 * @throws Exception if something goes wrong
12471248 */
1248- protected final WebDriver loadPageWithAlerts2 (final String html , final long maxWaitTime ) throws Exception {
1249+ protected final WebDriver loadPageWithAlerts2 (final String html , final Duration maxWaitTime ) throws Exception {
12491250 return loadPageWithAlerts2 (html , URL_FIRST , maxWaitTime );
12501251 }
12511252
@@ -1268,7 +1269,7 @@ protected final WebDriver loadPageWithAlerts2(final String html, final URL url)
12681269 * @return the web driver
12691270 * @throws Exception if something goes wrong
12701271 */
1271- protected final WebDriver loadPageWithAlerts2 (final String html , final URL url , final long maxWaitTime )
1272+ protected final WebDriver loadPageWithAlerts2 (final String html , final URL url , final Duration maxWaitTime )
12721273 throws Exception {
12731274 final WebDriver driver = loadPage2 (html , url );
12741275
@@ -1294,7 +1295,7 @@ protected void verifyAlerts(final WebDriver driver, final String... expectedAler
12941295 * @param expected the expected alerts
12951296 * @throws Exception in case of failure
12961297 */
1297- protected void verifyAlerts (final long maxWaitTime , final WebDriver driver , final String ... expected )
1298+ protected void verifyAlerts (final Duration maxWaitTime , final WebDriver driver , final String ... expected )
12981299 throws Exception {
12991300 final List <String > actualAlerts = getCollectedAlerts (maxWaitTime , driver , expected .length );
13001301
@@ -1342,7 +1343,7 @@ protected final WebDriver loadPageWithAlerts2(final String html,
13421343 * @return the web driver
13431344 * @throws Exception if something goes wrong
13441345 */
1345- protected final WebDriver loadPageWithAlerts2 (final String html , final URL url , final long maxWaitTime ,
1346+ protected final WebDriver loadPageWithAlerts2 (final String html , final URL url , final Duration maxWaitTime ,
13461347 final Map <String , Class <? extends Servlet >> servlets ) throws Exception {
13471348
13481349 expandExpectedAlertsVariables (URL_FIRST );
@@ -1371,7 +1372,7 @@ protected final WebDriver loadPageWithAlerts2(final URL url) throws Exception {
13711372 * @return the web driver
13721373 * @throws Exception if something goes wrong
13731374 */
1374- protected final WebDriver loadPageWithAlerts2 (final URL url , final long maxWaitTime ) throws Exception {
1375+ protected final WebDriver loadPageWithAlerts2 (final URL url , final Duration maxWaitTime ) throws Exception {
13751376 startWebServer (getMockWebConnection (), null );
13761377
13771378 final WebDriver driver = getWebDriver ();
@@ -1413,11 +1414,11 @@ protected List<String> getCollectedAlerts(final WebDriver driver, final int aler
14131414 * @return the collected alerts
14141415 * @throws Exception in case of problem
14151416 */
1416- protected List <String > getCollectedAlerts (final long maxWaitTime , final WebDriver driver , final int alertsLength )
1417- throws Exception {
1417+ protected List <String > getCollectedAlerts (final Duration maxWaitTime ,
1418+ final WebDriver driver , final int alertsLength ) throws Exception {
14181419 final List <String > collectedAlerts = new ArrayList <>();
14191420
1420- long maxWait = System .currentTimeMillis () + maxWaitTime ;
1421+ long maxWait = System .currentTimeMillis () + maxWaitTime . toMillis () ;
14211422
14221423 while (collectedAlerts .size () < alertsLength && System .currentTimeMillis () < maxWait ) {
14231424 try {
@@ -1567,7 +1568,7 @@ public void beforeTest() throws InterruptedException {
15671568 * @throws Exception in case of failure
15681569 */
15691570 protected void assertTitle (final WebDriver webdriver , final String expected ) throws Exception {
1570- final long maxWait = System .currentTimeMillis () + DEFAULT_WAIT_TIME ;
1571+ final long maxWait = System .currentTimeMillis () + DEFAULT_WAIT_TIME . toMillis () ;
15711572
15721573 while (true ) {
15731574 final String title = webdriver .getTitle ();
0 commit comments