2121import static java .util .concurrent .TimeUnit .SECONDS ;
2222import static java .util .logging .Level .SEVERE ;
2323import static org .openqa .selenium .remote .CapabilityType .PLATFORM_NAME ;
24- import static org .openqa .selenium .remote .CapabilityType .SUPPORTS_JAVASCRIPT ;
2524
2625import com .google .common .collect .ImmutableMap ;
2726import com .google .common .collect .ImmutableSet ;
@@ -471,12 +470,6 @@ public String getWindowHandle() {
471470
472471 @ Override
473472 public Object executeScript (String script , Object ... args ) {
474- if (!isJavascriptEnabled ()) {
475- throw new UnsupportedOperationException (
476- "You must be using an underlying instance of WebDriver that supports executing"
477- + " javascript" );
478- }
479-
480473 List <Object > convertedArgs =
481474 Stream .of (args ).map (new WebElementToJsonConverter ()).collect (Collectors .toList ());
482475
@@ -485,22 +478,12 @@ public Object executeScript(String script, Object... args) {
485478
486479 @ Override
487480 public Object executeAsyncScript (String script , Object ... args ) {
488- if (!isJavascriptEnabled ()) {
489- throw new UnsupportedOperationException (
490- "You must be using an underlying instance of "
491- + "WebDriver that supports executing javascript" );
492- }
493-
494481 List <Object > convertedArgs =
495482 Stream .of (args ).map (new WebElementToJsonConverter ()).collect (Collectors .toList ());
496483
497484 return execute (DriverCommand .EXECUTE_ASYNC_SCRIPT (script , convertedArgs )).getValue ();
498485 }
499486
500- private boolean isJavascriptEnabled () {
501- return getCapabilities ().is (SUPPORTS_JAVASCRIPT );
502- }
503-
504487 @ Override
505488 public TargetLocator switchTo () {
506489 return new RemoteTargetLocator ();
0 commit comments