Skip to content

Commit

Permalink
[py] do not send parameters in payload that are used in endpoint (#12685
Browse files Browse the repository at this point in the history
)
  • Loading branch information
titusfortner authored Sep 16, 2023
1 parent b56c0b6 commit 14e43b1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions py/selenium/webdriver/remote/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,12 @@ def execute(self, command, params):
"""
command_info = self._commands[command]
assert command_info is not None, f"Unrecognised command {command}"
path = string.Template(command_info[1]).substitute(params)
if isinstance(params, dict) and "sessionId" in params:
del params["sessionId"]
path_string = command_info[1]
path = string.Template(path_string).substitute(params)
substitute_params = {word[1:] for word in path_string.split("/") if word.startswith("$")} # remove dollar sign
if isinstance(params, dict) and substitute_params:
for word in substitute_params:
del params[word]
data = utils.dump_json(params)
url = f"{self._url}{path}"
return self._request(command_info[0], url, body=data)
Expand Down

0 comments on commit 14e43b1

Please sign in to comment.