@@ -279,10 +279,6 @@ protected void setCommandExecutor(CommandExecutor executor) {
279
279
this .executor = executor ;
280
280
}
281
281
282
- public synchronized void setCommandExecutionTimeout (Duration timeout ) {
283
- executor .setCommandExecutionTimeout (timeout );
284
- }
285
-
286
282
@ Override
287
283
public Capabilities getCapabilities () {
288
284
return capabilities ;
@@ -320,10 +316,9 @@ public <X> X getScreenshotAs(OutputType<X> outputType) throws WebDriverException
320
316
String base64EncodedPng = new String ((byte []) result , UTF_8 );
321
317
return outputType .convertFromBase64Png (base64EncodedPng );
322
318
} else {
323
- throw new RuntimeException (String .format (
324
- "Unexpected result for %s command: %s" ,
325
- DriverCommand .SCREENSHOT ,
326
- result == null ? "null" : result .getClass ().getName () + " instance" ));
319
+ throw new RuntimeException (String .format ("Unexpected result for %s command: %s" ,
320
+ DriverCommand .SCREENSHOT ,
321
+ result == null ? "null" : result .getClass ().getName () + " instance" ));
327
322
}
328
323
}
329
324
@@ -443,15 +438,14 @@ public String getWindowHandle() {
443
438
public Object executeScript (String script , Object ... args ) {
444
439
if (!isJavascriptEnabled ()) {
445
440
throw new UnsupportedOperationException (
446
- "You must be using an underlying instance of WebDriver that supports executing javascript" );
441
+ "You must be using an underlying instance of WebDriver that supports executing javascript" );
447
442
}
448
443
449
444
// Escape the quote marks
450
445
script = script .replaceAll ("\" " , "\\ \" " );
451
446
452
- List <Object > convertedArgs = Stream .of (args )
453
- .map (new WebElementToJsonConverter ())
454
- .collect (Collectors .toList ());
447
+ List <Object > convertedArgs = Stream .of (args ).map (new WebElementToJsonConverter ()).collect (
448
+ Collectors .toList ());
455
449
456
450
return execute (DriverCommand .EXECUTE_SCRIPT (script , convertedArgs )).getValue ();
457
451
}
@@ -460,15 +454,14 @@ public Object executeScript(String script, Object... args) {
460
454
public Object executeAsyncScript (String script , Object ... args ) {
461
455
if (!isJavascriptEnabled ()) {
462
456
throw new UnsupportedOperationException ("You must be using an underlying instance of " +
463
- "WebDriver that supports executing javascript" );
457
+ "WebDriver that supports executing javascript" );
464
458
}
465
459
466
460
// Escape the quote marks
467
461
script = script .replaceAll ("\" " , "\\ \" " );
468
462
469
- List <Object > convertedArgs = Stream .of (args )
470
- .map (new WebElementToJsonConverter ())
471
- .collect (Collectors .toList ());
463
+ List <Object > convertedArgs = Stream .of (args ).map (new WebElementToJsonConverter ()).collect (
464
+ Collectors .toList ());
472
465
473
466
return execute (DriverCommand .EXECUTE_ASYNC_SCRIPT (script , convertedArgs )).getValue ();
474
467
}
@@ -603,15 +596,15 @@ public Mouse getMouse() {
603
596
604
597
@ Override
605
598
public VirtualAuthenticator addVirtualAuthenticator (VirtualAuthenticatorOptions options ) {
606
- String authenticatorId = (String ) execute (
607
- DriverCommand .ADD_VIRTUAL_AUTHENTICATOR , options .toMap ()).getValue ();
599
+ String authenticatorId = (String )
600
+ execute ( DriverCommand .ADD_VIRTUAL_AUTHENTICATOR , options .toMap ()).getValue ();
608
601
return new RemoteVirtualAuthenticator (authenticatorId );
609
602
}
610
603
611
604
@ Override
612
605
public void removeVirtualAuthenticator (VirtualAuthenticator authenticator ) {
613
606
execute (DriverCommand .REMOVE_VIRTUAL_AUTHENTICATOR ,
614
- ImmutableMap .of ("authenticatorId" , authenticator .getId ()));
607
+ ImmutableMap .of ("authenticatorId" , authenticator .getId ()));
615
608
}
616
609
617
610
/**
@@ -694,24 +687,24 @@ public Set<Cookie> getCookies() {
694
687
}
695
688
696
689
((Collection <?>) returned ).stream ()
697
- .map (o -> (Map <String , Object >) o )
698
- .map (rawCookie -> {
699
- // JSON object keys are defined in
700
- // https://w3c.github.io/webdriver/#dfn-table-for-cookie-conversion.
701
- Cookie .Builder builder =
702
- new Cookie .Builder ((String ) rawCookie .get ("name" ), (String ) rawCookie .get ("value" ))
703
- .path ((String ) rawCookie .get ("path" ))
704
- .domain ((String ) rawCookie .get ("domain" ))
705
- .isSecure (rawCookie .containsKey ("secure" ) && (Boolean ) rawCookie .get ("secure" ))
706
- .isHttpOnly (
707
- rawCookie .containsKey ("httpOnly" ) && (Boolean ) rawCookie .get ("httpOnly" ))
708
- .sameSite ((String ) rawCookie .get ("sameSite" ));
709
-
710
- Number expiryNum = (Number ) rawCookie .get ("expiry" );
711
- builder .expiresOn (expiryNum == null ? null : new Date (SECONDS .toMillis (expiryNum .longValue ())));
712
- return builder .build ();
713
- })
714
- .forEach (toReturn ::add );
690
+ .map (o -> (Map <String , Object >) o )
691
+ .map (rawCookie -> {
692
+ // JSON object keys are defined in
693
+ // https://w3c.github.io/webdriver/#dfn-table-for-cookie-conversion.
694
+ Cookie .Builder builder =
695
+ new Cookie .Builder ((String ) rawCookie .get ("name" ), (String ) rawCookie .get ("value" ))
696
+ .path ((String ) rawCookie .get ("path" ))
697
+ .domain ((String ) rawCookie .get ("domain" ))
698
+ .isSecure (rawCookie .containsKey ("secure" ) && (Boolean ) rawCookie .get ("secure" ))
699
+ .isHttpOnly (
700
+ rawCookie .containsKey ("httpOnly" ) && (Boolean ) rawCookie .get ("httpOnly" ))
701
+ .sameSite ((String ) rawCookie .get ("sameSite" ));
702
+
703
+ Number expiryNum = (Number ) rawCookie .get ("expiry" );
704
+ builder .expiresOn (expiryNum == null ? null : new Date (SECONDS .toMillis (expiryNum .longValue ())));
705
+ return builder .build ();
706
+ })
707
+ .forEach (toReturn ::add );
715
708
716
709
return toReturn ;
717
710
}
@@ -910,10 +903,10 @@ public WebDriver frame(int frameIndex) {
910
903
public WebDriver frame (String frameName ) {
911
904
String name = frameName .replaceAll ("(['\" \\ \\ #.:;,!?+<>=~*^$|%&@`{}\\ -/\\ [\\ ]\\ (\\ )])" , "\\ \\ $1" );
912
905
List <WebElement > frameElements = RemoteWebDriver .this .findElements (
913
- By .cssSelector ("frame[name='" + name + "'],iframe[name='" + name + "']" ));
906
+ By .cssSelector ("frame[name='" + name + "'],iframe[name='" + name + "']" ));
914
907
if (frameElements .size () == 0 ) {
915
908
frameElements = RemoteWebDriver .this .findElements (
916
- By .cssSelector ("frame#" + name + ",iframe#" + name ));
909
+ By .cssSelector ("frame#" + name + ",iframe#" + name ));
917
910
}
918
911
if (frameElements .size () == 0 ) {
919
912
throw new NoSuchFrameException ("No frame element found by name or id " + frameName );
@@ -1035,16 +1028,16 @@ public String getId() {
1035
1028
@ Override
1036
1029
public void addCredential (Credential credential ) {
1037
1030
execute (DriverCommand .ADD_CREDENTIAL ,
1038
- new ImmutableMap .Builder <String , Object >()
1039
- .putAll (credential .toMap ())
1040
- .put ("authenticatorId" , id )
1041
- .build ());
1031
+ new ImmutableMap .Builder <String , Object >()
1032
+ .putAll (credential .toMap ())
1033
+ .put ("authenticatorId" , id )
1034
+ .build ());
1042
1035
}
1043
1036
1044
1037
@ Override
1045
1038
public List <Credential > getCredentials () {
1046
- List <Map <String , Object >> response = (List <Map <String , Object >>) execute (
1047
- DriverCommand .GET_CREDENTIALS , ImmutableMap .of ("authenticatorId" , id )).getValue ();
1039
+ List <Map <String , Object >> response = (List <Map <String , Object >>)
1040
+ execute ( DriverCommand .GET_CREDENTIALS , ImmutableMap .of ("authenticatorId" , id )).getValue ();
1048
1041
return response .stream ().map (Credential ::fromMap ).collect (Collectors .toList ());
1049
1042
}
1050
1043
@@ -1056,7 +1049,7 @@ public void removeCredential(byte[] credentialId) {
1056
1049
@ Override
1057
1050
public void removeCredential (String credentialId ) {
1058
1051
execute (DriverCommand .REMOVE_CREDENTIAL ,
1059
- ImmutableMap .of ("authenticatorId" , id , "credentialId" , credentialId ));
1052
+ ImmutableMap .of ("authenticatorId" , id , "credentialId" , credentialId ));
1060
1053
}
1061
1054
1062
1055
@ Override
@@ -1067,7 +1060,7 @@ public void removeAllCredentials() {
1067
1060
@ Override
1068
1061
public void setUserVerified (boolean verified ) {
1069
1062
execute (DriverCommand .SET_USER_VERIFIED ,
1070
- ImmutableMap .of ("authenticatorId" , id , "isUserVerified" , verified ));
1063
+ ImmutableMap .of ("authenticatorId" , id , "isUserVerified" , verified ));
1071
1064
}
1072
1065
}
1073
1066
@@ -1094,10 +1087,10 @@ public String toString() {
1094
1087
}
1095
1088
1096
1089
return String .format (
1097
- "%s: %s on %s (%s)" ,
1098
- getClass ().getSimpleName (),
1099
- caps .getBrowserName (),
1100
- platform ,
1101
- getSessionId ());
1090
+ "%s: %s on %s (%s)" ,
1091
+ getClass ().getSimpleName (),
1092
+ caps .getBrowserName (),
1093
+ platform ,
1094
+ getSessionId ());
1102
1095
}
1103
1096
}
0 commit comments