Skip to content

Commit c412ace

Browse files
committed
Adds Wait Until Page Does Not Contain method
1 parent 4efcb9c commit c412ace

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Selenium2Library/keywords/_waiting.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,27 @@ def wait_until_page_contains(self, text, timeout=None, error=None):
4545
error = "Text '%s' did not appear in <TIMEOUT>" % text
4646
self._wait_until(timeout, error, self._is_text_present, text)
4747

48+
def wait_until_page_does_not_contain(self, text, timeout=None, error=None):
49+
"""Waits until `text` disappears from current page.
50+
51+
Fails if `timeout` expires before the `text` disappears. See
52+
`introduction` for more information about `timeout` and its
53+
default value.
54+
55+
`error` can be used to override the default error message.
56+
57+
See also `Wait Until Page Contains`, `Wait For Condition`,
58+
`Wait Until Element Is Visible` and BuiltIn keyword `Wait Until
59+
Keyword Succeeds`.
60+
"""
61+
def check_present():
62+
present = self._is_text_present(text)
63+
if not present:
64+
return
65+
else:
66+
return error or "Text '%s' did not disappear in %s" % (text, self._format_timeout(timeout))
67+
self._wait_until_no_error(timeout, check_present)
68+
4869
def wait_until_page_contains_element(self, locator, timeout=None, error=None):
4970
"""Waits until element specified with `locator` appears on current page.
5071

0 commit comments

Comments
 (0)