Skip to content

Commit c5db2c1

Browse files
committed
Do some refactoring
1 parent be8c318 commit c5db2c1

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

seleniumbase/core/sb_cdp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ def is_checked(self, selector):
16041604
"""Return True if checkbox (or radio button) is checked."""
16051605
selector = self.__convert_to_css_if_xpath(selector)
16061606
self.find_element(selector, timeout=settings.SMALL_TIMEOUT)
1607-
return self.get_element_attribute(selector, "checked")
1607+
return bool(self.get_element_attribute(selector, "checked"))
16081608

16091609
def is_selected(self, selector):
16101610
selector = self.__convert_to_css_if_xpath(selector)

seleniumbase/fixtures/base_case.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,8 +2494,10 @@ def is_checked(self, selector, by="css selector", timeout=None):
24942494
kind = self.get_attribute(selector, "type", by=by, timeout=timeout)
24952495
if kind != "checkbox" and kind != "radio":
24962496
raise Exception("Expecting a checkbox or a radio button element!")
2497-
return self.get_attribute(
2498-
selector, "checked", by=by, timeout=timeout, hard_fail=False
2497+
return bool(
2498+
self.get_attribute(
2499+
selector, "checked", by=by, timeout=timeout, hard_fail=False
2500+
)
24992501
)
25002502

25012503
def is_selected(self, selector, by="css selector", timeout=None):
@@ -15166,9 +15168,12 @@ def setUp(self, masterqa_mode=False):
1516615168
self.driver.close()
1516715169
self.switch_to_window(0)
1516815170
if self._crumbs:
15169-
self.wait_for_ready_state_complete()
15170-
with suppress(Exception):
15171-
self.driver.delete_all_cookies()
15171+
if self.binary_location == "chs":
15172+
self.delete_session_storage()
15173+
else:
15174+
self.wait_for_ready_state_complete()
15175+
with suppress(Exception):
15176+
self.driver.delete_all_cookies()
1517215177
if self._reuse_session and sb_config.shared_driver and has_url:
1517315178
good_start_page = False
1517415179
if self.recorder_ext:

0 commit comments

Comments
 (0)