Skip to content

Commit

Permalink
add se namespacing to file upload endpoint for all bindings (Selenium…
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Aug 13, 2020
1 parent 2a5b016 commit 824617b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected override void InitializeCommandDictionary()
this.TryAddCommand(DriverCommand.IsElementDisplayed, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/element/{id}/displayed"));
this.TryAddCommand(DriverCommand.ElementEquals, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/element/{id}/equals/{other}"));
this.TryAddCommand(DriverCommand.DefineDriverMapping, new CommandInfo(CommandInfo.PostCommand, "/config/drivers"));
this.TryAddCommand(DriverCommand.UploadFile, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/file"));
this.TryAddCommand(DriverCommand.UploadFile, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/se/file"));
this.TryAddCommand(DriverCommand.SetAlertCredentials, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/alert/credentials"));
this.TryAddCommand(DriverCommand.GetSessionList, new CommandInfo(CommandInfo.GetCommand, "/sessions"));
this.TryAddCommand(DriverCommand.GetElementLocationOnceScrolledIntoView, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/element/{id}/location_in_view"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
import static org.openqa.selenium.remote.DriverCommand.SWITCH_TO_NEW_WINDOW;
import static org.openqa.selenium.remote.DriverCommand.SWITCH_TO_PARENT_FRAME;
import static org.openqa.selenium.remote.DriverCommand.SWITCH_TO_WINDOW;
import static org.openqa.selenium.remote.DriverCommand.UPLOAD_FILE;
import static org.openqa.selenium.remote.http.Contents.bytes;
import static org.openqa.selenium.remote.http.Contents.string;

Expand Down Expand Up @@ -164,7 +163,6 @@ public AbstractHttpCommandCodec() {

defineCommand(SET_ALERT_CREDENTIALS, post(sessionId + "/alert/credentials"));

defineCommand(UPLOAD_FILE, post(sessionId + "/file"));
defineCommand(SCREENSHOT, get(sessionId + "/screenshot"));
defineCommand(ELEMENT_SCREENSHOT, get(sessionId + "/element/:id/screenshot"));
defineCommand(GET_TITLE, get(sessionId + "/title"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import static org.openqa.selenium.remote.DriverCommand.MOUSE_DOWN;
import static org.openqa.selenium.remote.DriverCommand.MOUSE_UP;
import static org.openqa.selenium.remote.DriverCommand.MOVE_TO;
import static org.openqa.selenium.remote.DriverCommand.UPLOAD_FILE;
import static org.openqa.selenium.remote.DriverCommand.REMOVE_LOCAL_STORAGE_ITEM;
import static org.openqa.selenium.remote.DriverCommand.REMOVE_SESSION_STORAGE_ITEM;
import static org.openqa.selenium.remote.DriverCommand.SEND_KEYS_TO_ACTIVE_ELEMENT;
Expand Down Expand Up @@ -107,6 +108,8 @@ public JsonHttpCommandCodec() {
defineCommand(GET_ALERT_TEXT, get(sessionId + "/alert_text"));
defineCommand(SET_ALERT_VALUE, post(sessionId + "/alert_text"));

defineCommand(UPLOAD_FILE, post(sessionId + "/file"));

defineCommand(GET_ACTIVE_ELEMENT, post(sessionId + "/element/active"));

String localStorage = sessionId + "/local_storage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import static org.openqa.selenium.remote.DriverCommand.SET_SESSION_STORAGE_ITEM;
import static org.openqa.selenium.remote.DriverCommand.SET_TIMEOUT;
import static org.openqa.selenium.remote.DriverCommand.SUBMIT_ELEMENT;
import static org.openqa.selenium.remote.DriverCommand.UPLOAD_FILE;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -149,6 +150,8 @@ public W3CHttpCommandCodec() {
defineCommand(GET_ALERT_TEXT, get(alert + "/text"));
defineCommand(SET_ALERT_VALUE, post(alert + "/text"));

defineCommand(UPLOAD_FILE, post(sessionId + "/se/file"));

defineCommand(GET_ACTIVE_ELEMENT, get(sessionId + "/element/active"));

defineCommand(ACTIONS, post(sessionId + "/actions"));
Expand Down
2 changes: 1 addition & 1 deletion javascript/node/selenium-webdriver/lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ const COMMAND_MAP = new Map([
[cmd.Name.GET_LOG, post('/session/:sessionId/log')],
[cmd.Name.GET_AVAILABLE_LOG_TYPES, get('/session/:sessionId/log/types')],
[cmd.Name.GET_SESSION_LOGS, post('/logs')],
[cmd.Name.UPLOAD_FILE, post('/session/:sessionId/file')],
[cmd.Name.UPLOAD_FILE, post('/session/:sessionId/se/file')],
[cmd.Name.LEGACY_ACTION_CLICK, post('/session/:sessionId/click')],
[
cmd.Name.LEGACY_ACTION_DOUBLE_CLICK,
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/remote/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __init__(self, remote_server_addr, keep_alive=False, resolve_ip=None):
('POST', '/session/$sessionId/element/$id/value'),
Command.SEND_KEYS_TO_ACTIVE_ELEMENT:
('POST', '/session/$sessionId/keys'),
Command.UPLOAD_FILE: ('POST', "/session/$sessionId/file"),
Command.UPLOAD_FILE: ('POST', "/session/$sessionId/se/file"),
Command.GET_ELEMENT_VALUE:
('GET', '/session/$sessionId/element/$id/value'),
Command.GET_ELEMENT_TAG_NAME:
Expand Down
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/remote/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Bridge
# server extensions
#

upload_file: [:post, 'session/:session_id/file']
upload_file: [:post, 'session/:session_id/se/file']
}.freeze

end # Bridge
Expand Down

0 comments on commit 824617b

Please sign in to comment.