Skip to content

Commit bcbf432

Browse files
committed
[py]: Options now returns bool values for various properties when not set rather than None
1 parent 2ce00fc commit bcbf432

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

py/CHANGES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
Selenium (TBA next version)
22
* Fix frame_to_be_available_and_switch_to_it() for string inputs (#10963)
3-
* Implicit non w3c capability conversion for `acceptSslCerts`, `platform` and `version` is now deprecated.
3+
* Implicit non w3c capability conversion for `acceptSslCerts`, `platform` and `version` is now deprecated
44
* Additional type hints
55
* Less strict requirements on the version of `certifi`
6+
* Bugfix options returning `None` when strict_file_interactability, set_window_rect or accept_insecure_certs are not set
67

78

89
Selenium 4.4.3

py/selenium/webdriver/common/options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def accept_insecure_certs(self) -> bool:
157157
"""
158158
:returns: whether the session accepts insecure certificates
159159
"""
160-
return self._caps.get('acceptInsecureCerts')
160+
return self._caps.get('acceptInsecureCerts', False)
161161

162162
@accept_insecure_certs.setter
163163
def accept_insecure_certs(self, value: bool) -> None:
@@ -174,7 +174,7 @@ def strict_file_interactability(self) -> bool:
174174
"""
175175
:returns: whether session is strict about file interactability
176176
"""
177-
return self._caps.get('strictFileInteractability')
177+
return self._caps.get('strictFileInteractability', False)
178178

179179
@strict_file_interactability.setter
180180
def strict_file_interactability(self, value: bool) -> None:
@@ -190,7 +190,7 @@ def set_window_rect(self) -> bool:
190190
"""
191191
:returns: whether the remote end supports setting window size and position
192192
"""
193-
return self._caps.get('setWindowRect')
193+
return self._caps.get('setWindowRect', False)
194194

195195
@set_window_rect.setter
196196
def set_window_rect(self, value: bool) -> None:

py/test/unit/selenium/webdriver/common/common_options_tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,10 @@ def test_enable_mobile_with_device_serial(options):
5858
android_activity="crackers",
5959
device_serial="1234")
6060
options.mobile_options["androidDeviceSerial"] == "1234"
61+
62+
63+
def test_missing_capabilities_return_false_rather_than_none():
64+
options = ArgOptions()
65+
assert options.strict_file_interactability is False
66+
assert options.set_window_rect is False
67+
assert options.accept_insecure_certs is False

0 commit comments

Comments
 (0)