Skip to content

Commit 3b7313c

Browse files
committed
format
1 parent 718ebc1 commit 3b7313c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

modules/page_base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,16 @@ def wait_for_num_tabs(self, num_tabs: int) -> Page:
551551
logging.warn("Timeout waiting for the number of windows to be:", num_tabs)
552552
return self
553553

554+
def wait_for_no_children(
555+
self, parent: Union[str, tuple, WebElement], labels=[]
556+
) -> Page:
557+
"""
558+
Waits for 0 children under the given parent, the wait is instant
559+
"""
560+
self.instawait.until(
561+
lambda _: len(self.get_all_children(self.fetch(parent, labels))) == 0
562+
)
563+
554564
def switch_to_new_tab(self) -> Page:
555565
"""Get list of all window handles, switch to the newly opened tab"""
556566
handles = self.driver.window_handles

tests/security_and_privacy/test_cookies_not_saved_private_browsing.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,5 @@ def test_cookies_not_saved_private_browsing(driver: Firefox):
3939
iframe = about_prefs.get_iframe()
4040
ba.switch_to_iframe_context(iframe)
4141

42-
# ensure none are listed
43-
sitelist = about_prefs.get_element("cookies-manage-data-sitelist")
44-
sites = about_prefs.get_all_children(sitelist)
45-
46-
# note when there are 0 children, this is a bit slow
47-
assert len(sites) == 0
42+
# wait for no children listed in the cookies menu
43+
about_prefs.wait_for_no_children("cookies-manage-data-sitelist")

0 commit comments

Comments
 (0)