Skip to content

Commit e2542bb

Browse files
authored
[py]: #11093 - The SessionId shouldn't be added to params themself bu… (#11121)
* [py]: #11093 - The SessionId shouldn't be added to params themself but to a copy of them. * [py] Add an unit test to check the session id is not preserved in print options after a page is printed. * [py] Update the test_session_id_is_not_preserved_after_page_is_printed test to comply with coding conventions.
1 parent aa23847 commit e2542bb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

py/selenium/webdriver/remote/webdriver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,14 @@ def execute(self, driver_command: str, params: dict = None) -> dict:
431431
:Returns:
432432
The command's JSON response loaded into a dictionary object.
433433
"""
434+
params = self._wrap_value(params)
435+
434436
if self.session_id:
435437
if not params:
436438
params = {"sessionId": self.session_id}
437439
elif "sessionId" not in params:
438440
params["sessionId"] = self.session_id
439441

440-
params = self._wrap_value(params)
441442
response = self.command_executor.execute(driver_command, params)
442443
if response:
443444
self.error_handler.check_response(response)

py/test/selenium/webdriver/common/print_pdf_tests.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,12 @@ def test_valid_params(driver, pages):
5151
base64code = driver.print_page(print_options)
5252

5353
assert base64code[START_INDEX:END_INDEX] == PDF_MAGIC_NUMBER
54+
55+
56+
def test_session_id_is_not_preserved_after_page_is_printed(driver, pages):
57+
print_options = PrintOptions()
58+
print_options.margin_bottom = print_options.margin_top = print_options.margin_left = print_options.margin_right = 0
59+
assert "sessionId" not in print_options.to_dict()
60+
pages.load("printPage.html")
61+
driver.print_page(print_options=print_options)
62+
assert "sessionId" not in print_options.to_dict()

0 commit comments

Comments
 (0)