@@ -859,9 +859,14 @@ public void setSize(Dimension targetSize) {
859
859
}
860
860
861
861
public void setPosition (Point targetPosition ) {
862
- execute (DriverCommand .SET_WINDOW_POSITION ,
863
- ImmutableMap
864
- .of ("windowHandle" , "current" , "x" , targetPosition .x , "y" , targetPosition .y ));
862
+ if (getW3CStandardComplianceLevel () == 0 ) {
863
+ execute (DriverCommand .SET_WINDOW_POSITION ,
864
+ ImmutableMap
865
+ .of ("windowHandle" , "current" , "x" , targetPosition .x , "y" , targetPosition .y ));
866
+ } else {
867
+ executeScript ("window.screenX = arguments[0]; window.screenY = arguments[1]" ,
868
+ targetPosition .x , targetPosition .y );
869
+ }
865
870
}
866
871
867
872
@ SuppressWarnings ({"unchecked" })
@@ -879,10 +884,16 @@ public Dimension getSize() {
879
884
}
880
885
881
886
@ SuppressWarnings ({"unchecked" })
887
+ Map <String , Object > rawPoint ;
882
888
public Point getPosition () {
883
- Response response = execute (DriverCommand .GET_WINDOW_POSITION ,
884
- ImmutableMap .of ("windowHandle" , "current" ));
885
- Map <String , Object > rawPoint = (Map <String , Object >) response .getValue ();
889
+ if (getW3CStandardComplianceLevel () == 0 ) {
890
+ Response response = execute (DriverCommand .GET_WINDOW_POSITION ,
891
+ ImmutableMap .of ("windowHandle" , "current" ));
892
+ rawPoint = (Map <String , Object >) response .getValue ();
893
+ } else {
894
+ rawPoint = (Map <String , Object >) executeScript (
895
+ "return {x: window.screenX, y: window.screenY}" );
896
+ }
886
897
887
898
int x = ((Number ) rawPoint .get ("x" )).intValue ();
888
899
int y = ((Number ) rawPoint .get ("y" )).intValue ();
0 commit comments