Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ Release Notes

1.7 (unreleased)
----------------
- Added new keyword 'Wait Until Page Does Not Contain'.
[deiga]

- Fixed ‘NoSuchWindowException' issue. Running keyword 'Select Window' after 'Close Window'
will trigger this issue if locator has prefix 'name=','title=' or 'url='. Also fixed same
issue for keywords 'Get Window Ids', 'Get Window Titles' and 'Get Window Names'.
[divfor]

- Corrected error message in new keyword 'Wait Until Element Is Not
Visible' to reflect element being visible instead of not visible.
[joepurdy]
Expand Down
21 changes: 21 additions & 0 deletions src/Selenium2Library/keywords/_waiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ def wait_until_page_contains(self, text, timeout=None, error=None):
error = "Text '%s' did not appear in <TIMEOUT>" % text
self._wait_until(timeout, error, self._is_text_present, text)

def wait_until_page_does_not_contain(self, text, timeout=None, error=None):
"""Waits until `text` disappears from current page.

Fails if `timeout` expires before the `text` disappears. See
`introduction` for more information about `timeout` and its
default value.

`error` can be used to override the default error message.

See also `Wait Until Page Contains`, `Wait For Condition`,
`Wait Until Element Is Visible` and BuiltIn keyword `Wait Until
Keyword Succeeds`.
"""
def check_present():
present = self._is_text_present(text)
if not present:
return
else:
return error or "Text '%s' did not disappear in %s" % (text, self._format_timeout(timeout))
self._wait_until_no_error(timeout, check_present)

def wait_until_page_contains_element(self, locator, timeout=None, error=None):
"""Waits until element specified with `locator` appears on current page.

Expand Down
4 changes: 4 additions & 0 deletions test/acceptance/keywords/waiting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Wait Until Page Contains
Wait Until Page Contains New Content 2 s
Run Keyword And Expect Error Text 'invalid' did not appear in 100 milliseconds Wait Until Page Contains invalid 0.1

Wait Until Page Does Not Contain
Wait Until Page Does Not Contain This is content 2 s
Run Keyword And Expect Error Text 'Inititally hidden' did not disappear in 100 milliseconds Wait Until Page Does Not Contain Inititally hidden 0.1

Wait Until Page Contains Element
[Documentation] Tests also that format characters (e.g. %c) are handled correctly in error messages
Wait Until Page Contains Element new div 2 seconds
Expand Down