@@ -488,7 +488,14 @@ public List<WebElement> findElementsByXPath(String using) {
488
488
// Misc
489
489
490
490
public String getPageSource () {
491
- return (String ) execute (DriverCommand .GET_PAGE_SOURCE ).getValue ();
491
+ if (getW3CStandardComplianceLevel () == 0 ) {
492
+ return (String ) execute (DriverCommand .GET_PAGE_SOURCE ).getValue ();
493
+ } else {
494
+ String script = "var source = document.documentElement.outerHTML; \n "
495
+ + "if (!source) { source = new XMLSerializer().serializeToString(document); }\n "
496
+ + "return source;" ;
497
+ return (String ) executeScript (script );
498
+ }
492
499
}
493
500
494
501
public void close () {
@@ -807,14 +814,16 @@ public void activateEngine(String engine) {
807
814
protected class RemoteTimeouts implements Timeouts {
808
815
809
816
public Timeouts implicitlyWait (long time , TimeUnit unit ) {
810
- execute (DriverCommand .IMPLICITLY_WAIT , ImmutableMap .of ("ms" ,
811
- TimeUnit .MILLISECONDS .convert (Math .max (0 , time ), unit )));
817
+ execute (DriverCommand .SET_TIMEOUT , ImmutableMap .of (
818
+ "type" , "implicit" ,
819
+ "ms" , TimeUnit .MILLISECONDS .convert (time , unit )));
812
820
return this ;
813
821
}
814
822
815
823
public Timeouts setScriptTimeout (long time , TimeUnit unit ) {
816
- execute (DriverCommand .SET_SCRIPT_TIMEOUT ,
817
- ImmutableMap .of ("ms" , TimeUnit .MILLISECONDS .convert (time , unit )));
824
+ execute (DriverCommand .SET_TIMEOUT , ImmutableMap .of (
825
+ "type" , "script" ,
826
+ "ms" , TimeUnit .MILLISECONDS .convert (time , unit )));
818
827
return this ;
819
828
}
820
829
0 commit comments