Skip to content

Commit 6109000

Browse files
committed
Normalise JS script execution between codecs
1 parent 88fa5ba commit 6109000

File tree

5 files changed

+106
-21
lines changed

5 files changed

+106
-21
lines changed

java/client/src/org/openqa/selenium/remote/DriverCommand.java

-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ public interface DriverCommand {
7474

7575
String EXECUTE_SCRIPT = "executeScript";
7676
String EXECUTE_ASYNC_SCRIPT = "executeAsyncScript";
77-
String EXECUTE_SCRIPT_W3C = "executeScriptW3C";
78-
String EXECUTE_ASYNC_SCRIPT_W3C = "executeAsyncScriptW3C";
7977

8078
String GET_ELEMENT_TEXT = "getElementText";
8179
String GET_ELEMENT_TAG_NAME = "getElementTagName";

java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java

-6
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,6 @@ public Object executeScript(String script, Object... args) {
569569
"script", script,
570570
"args", Lists.newArrayList(convertedArgs));
571571

572-
if (getW3CStandardComplianceLevel() > 0) {
573-
return execute(DriverCommand.EXECUTE_SCRIPT_W3C, params).getValue();
574-
}
575572
return execute(DriverCommand.EXECUTE_SCRIPT, params).getValue();
576573
}
577574

@@ -590,9 +587,6 @@ public Object executeAsyncScript(String script, Object... args) {
590587
Map<String, ?> params = ImmutableMap.of(
591588
"script", script, "args", Lists.newArrayList(convertedArgs));
592589

593-
if (getW3CStandardComplianceLevel() > 0) {
594-
return execute(DriverCommand.EXECUTE_ASYNC_SCRIPT_W3C, params).getValue();
595-
}
596590
return execute(DriverCommand.EXECUTE_ASYNC_SCRIPT, params).getValue();
597591
}
598592

java/client/src/org/openqa/selenium/remote/http/JsonHttpCommandCodec.java

-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ public JsonHttpCommandCodec() {
108108

109109
defineCommand(EXECUTE_SCRIPT, post("/session/:sessionId/execute"));
110110
defineCommand(EXECUTE_ASYNC_SCRIPT, post("/session/:sessionId/execute_async"));
111-
defineCommand(EXECUTE_SCRIPT_W3C, post("/session/:sessionId/execute/sync"));
112-
defineCommand(EXECUTE_ASYNC_SCRIPT_W3C, post("/session/:sessionId/execute/async"));
113111

114112
defineCommand(UPLOAD_FILE, post("/session/:sessionId/file"));
115113
defineCommand(SCREENSHOT, get("/session/:sessionId/screenshot"));

java/client/src/org/openqa/selenium/remote/http/W3CHttpCommandCodec.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ public W3CHttpCommandCodec() {
105105
defineCommand(SET_ALERT_VALUE, post("/session/:sessionId/alert/text"));
106106
defineCommand(SET_ALERT_CREDENTIALS, post("/session/:sessionId/alert/credentials"));
107107

108-
defineCommand(EXECUTE_SCRIPT, post("/session/:sessionId/execute"));
109-
defineCommand(EXECUTE_ASYNC_SCRIPT, post("/session/:sessionId/execute_async"));
110-
defineCommand(EXECUTE_SCRIPT_W3C, post("/session/:sessionId/execute/sync"));
111-
defineCommand(EXECUTE_ASYNC_SCRIPT_W3C, post("/session/:sessionId/execute/async"));
108+
defineCommand(EXECUTE_SCRIPT, post("/session/:sessionId/execute/sync"));
109+
defineCommand(EXECUTE_ASYNC_SCRIPT, post("/session/:sessionId/execute/async"));
112110

113111
defineCommand(UPLOAD_FILE, post("/session/:sessionId/file"));
114112
defineCommand(SCREENSHOT, get("/session/:sessionId/screenshot"));

java/server/src/org/openqa/selenium/remote/server/JsonHttpCommandHandler.java

+104-7
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,110 @@
2828
import org.openqa.selenium.remote.http.HttpResponse;
2929
import org.openqa.selenium.remote.http.JsonHttpCommandCodec;
3030
import org.openqa.selenium.remote.http.JsonHttpResponseCodec;
31-
import org.openqa.selenium.remote.server.handler.*;
32-
import org.openqa.selenium.remote.server.handler.html5.*;
33-
import org.openqa.selenium.remote.server.handler.interactions.*;
34-
import org.openqa.selenium.remote.server.handler.interactions.touch.*;
35-
import org.openqa.selenium.remote.server.handler.mobile.*;
31+
import org.openqa.selenium.remote.server.handler.AcceptAlert;
32+
import org.openqa.selenium.remote.server.handler.AddConfig;
33+
import org.openqa.selenium.remote.server.handler.AddCookie;
34+
import org.openqa.selenium.remote.server.handler.CaptureScreenshot;
35+
import org.openqa.selenium.remote.server.handler.ChangeUrl;
36+
import org.openqa.selenium.remote.server.handler.ClearElement;
37+
import org.openqa.selenium.remote.server.handler.ClickElement;
38+
import org.openqa.selenium.remote.server.handler.CloseWindow;
39+
import org.openqa.selenium.remote.server.handler.ConfigureTimeout;
40+
import org.openqa.selenium.remote.server.handler.DeleteCookie;
41+
import org.openqa.selenium.remote.server.handler.DeleteNamedCookie;
42+
import org.openqa.selenium.remote.server.handler.DeleteSession;
43+
import org.openqa.selenium.remote.server.handler.DismissAlert;
44+
import org.openqa.selenium.remote.server.handler.ElementEquality;
45+
import org.openqa.selenium.remote.server.handler.ExecuteAsyncScript;
46+
import org.openqa.selenium.remote.server.handler.ExecuteScript;
47+
import org.openqa.selenium.remote.server.handler.FindActiveElement;
48+
import org.openqa.selenium.remote.server.handler.FindChildElement;
49+
import org.openqa.selenium.remote.server.handler.FindChildElements;
50+
import org.openqa.selenium.remote.server.handler.FindElement;
51+
import org.openqa.selenium.remote.server.handler.FindElements;
52+
import org.openqa.selenium.remote.server.handler.FullscreenWindow;
53+
import org.openqa.selenium.remote.server.handler.GetAlertText;
54+
import org.openqa.selenium.remote.server.handler.GetAllCookies;
55+
import org.openqa.selenium.remote.server.handler.GetAllSessions;
56+
import org.openqa.selenium.remote.server.handler.GetAllWindowHandles;
57+
import org.openqa.selenium.remote.server.handler.GetAvailableLogTypesHandler;
58+
import org.openqa.selenium.remote.server.handler.GetCookie;
59+
import org.openqa.selenium.remote.server.handler.GetCssProperty;
60+
import org.openqa.selenium.remote.server.handler.GetCurrentUrl;
61+
import org.openqa.selenium.remote.server.handler.GetCurrentWindowHandle;
62+
import org.openqa.selenium.remote.server.handler.GetElementAttribute;
63+
import org.openqa.selenium.remote.server.handler.GetElementDisplayed;
64+
import org.openqa.selenium.remote.server.handler.GetElementEnabled;
65+
import org.openqa.selenium.remote.server.handler.GetElementLocation;
66+
import org.openqa.selenium.remote.server.handler.GetElementLocationInView;
67+
import org.openqa.selenium.remote.server.handler.GetElementRect;
68+
import org.openqa.selenium.remote.server.handler.GetElementSelected;
69+
import org.openqa.selenium.remote.server.handler.GetElementSize;
70+
import org.openqa.selenium.remote.server.handler.GetElementText;
71+
import org.openqa.selenium.remote.server.handler.GetLogHandler;
72+
import org.openqa.selenium.remote.server.handler.GetPageSource;
73+
import org.openqa.selenium.remote.server.handler.GetScreenOrientation;
74+
import org.openqa.selenium.remote.server.handler.GetSessionCapabilities;
75+
import org.openqa.selenium.remote.server.handler.GetSessionLogsHandler;
76+
import org.openqa.selenium.remote.server.handler.GetTagName;
77+
import org.openqa.selenium.remote.server.handler.GetTitle;
78+
import org.openqa.selenium.remote.server.handler.GetWindowPosition;
79+
import org.openqa.selenium.remote.server.handler.GetWindowSize;
80+
import org.openqa.selenium.remote.server.handler.GoBack;
81+
import org.openqa.selenium.remote.server.handler.GoForward;
82+
import org.openqa.selenium.remote.server.handler.ImeActivateEngine;
83+
import org.openqa.selenium.remote.server.handler.ImeDeactivate;
84+
import org.openqa.selenium.remote.server.handler.ImeGetActiveEngine;
85+
import org.openqa.selenium.remote.server.handler.ImeGetAvailableEngines;
86+
import org.openqa.selenium.remote.server.handler.ImeIsActivated;
87+
import org.openqa.selenium.remote.server.handler.ImplicitlyWait;
88+
import org.openqa.selenium.remote.server.handler.MaximizeWindow;
89+
import org.openqa.selenium.remote.server.handler.NewSession;
90+
import org.openqa.selenium.remote.server.handler.RefreshPage;
91+
import org.openqa.selenium.remote.server.handler.Rotate;
92+
import org.openqa.selenium.remote.server.handler.SendKeys;
93+
import org.openqa.selenium.remote.server.handler.SetAlertCredentials;
94+
import org.openqa.selenium.remote.server.handler.SetAlertText;
95+
import org.openqa.selenium.remote.server.handler.SetScriptTimeout;
96+
import org.openqa.selenium.remote.server.handler.SetWindowPosition;
97+
import org.openqa.selenium.remote.server.handler.SetWindowSize;
98+
import org.openqa.selenium.remote.server.handler.Status;
99+
import org.openqa.selenium.remote.server.handler.SubmitElement;
100+
import org.openqa.selenium.remote.server.handler.SwitchToFrame;
101+
import org.openqa.selenium.remote.server.handler.SwitchToParentFrame;
102+
import org.openqa.selenium.remote.server.handler.SwitchToWindow;
103+
import org.openqa.selenium.remote.server.handler.UploadFile;
104+
import org.openqa.selenium.remote.server.handler.html5.ClearLocalStorage;
105+
import org.openqa.selenium.remote.server.handler.html5.ClearSessionStorage;
106+
import org.openqa.selenium.remote.server.handler.html5.GetAppCacheStatus;
107+
import org.openqa.selenium.remote.server.handler.html5.GetLocalStorageItem;
108+
import org.openqa.selenium.remote.server.handler.html5.GetLocalStorageKeys;
109+
import org.openqa.selenium.remote.server.handler.html5.GetLocalStorageSize;
110+
import org.openqa.selenium.remote.server.handler.html5.GetLocationContext;
111+
import org.openqa.selenium.remote.server.handler.html5.GetSessionStorageItem;
112+
import org.openqa.selenium.remote.server.handler.html5.GetSessionStorageKeys;
113+
import org.openqa.selenium.remote.server.handler.html5.GetSessionStorageSize;
114+
import org.openqa.selenium.remote.server.handler.html5.RemoveLocalStorageItem;
115+
import org.openqa.selenium.remote.server.handler.html5.RemoveSessionStorageItem;
116+
import org.openqa.selenium.remote.server.handler.html5.SetLocalStorageItem;
117+
import org.openqa.selenium.remote.server.handler.html5.SetLocationContext;
118+
import org.openqa.selenium.remote.server.handler.html5.SetSessionStorageItem;
119+
import org.openqa.selenium.remote.server.handler.interactions.ClickInSession;
120+
import org.openqa.selenium.remote.server.handler.interactions.DoubleClickInSession;
121+
import org.openqa.selenium.remote.server.handler.interactions.MouseDown;
122+
import org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation;
123+
import org.openqa.selenium.remote.server.handler.interactions.MouseUp;
124+
import org.openqa.selenium.remote.server.handler.interactions.SendKeyToActiveElement;
125+
import org.openqa.selenium.remote.server.handler.interactions.touch.DoubleTapOnElement;
126+
import org.openqa.selenium.remote.server.handler.interactions.touch.Down;
127+
import org.openqa.selenium.remote.server.handler.interactions.touch.Flick;
128+
import org.openqa.selenium.remote.server.handler.interactions.touch.LongPressOnElement;
129+
import org.openqa.selenium.remote.server.handler.interactions.touch.Move;
130+
import org.openqa.selenium.remote.server.handler.interactions.touch.Scroll;
131+
import org.openqa.selenium.remote.server.handler.interactions.touch.SingleTapOnElement;
132+
import org.openqa.selenium.remote.server.handler.interactions.touch.Up;
133+
import org.openqa.selenium.remote.server.handler.mobile.GetNetworkConnection;
134+
import org.openqa.selenium.remote.server.handler.mobile.SetNetworkConnection;
36135
import org.openqa.selenium.remote.server.rest.RestishHandler;
37136
import org.openqa.selenium.remote.server.rest.ResultConfig;
38137

@@ -119,8 +218,6 @@ private void setUpMappings() {
119218

120219
addNewMapping(EXECUTE_SCRIPT, ExecuteScript.class);
121220
addNewMapping(EXECUTE_ASYNC_SCRIPT, ExecuteAsyncScript.class);
122-
addNewMapping(EXECUTE_SCRIPT_W3C, ExecuteScript.class);
123-
addNewMapping(EXECUTE_ASYNC_SCRIPT_W3C, ExecuteAsyncScript.class);
124221

125222
addNewMapping(GET_PAGE_SOURCE, GetPageSource.class);
126223

0 commit comments

Comments
 (0)