From c412ace33651ed69ee251aed602af783a051d42b Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Mon, 1 Jun 2015 13:17:46 +0300 Subject: [PATCH 1/3] Adds Wait Until Page Does Not Contain method --- src/Selenium2Library/keywords/_waiting.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Selenium2Library/keywords/_waiting.py b/src/Selenium2Library/keywords/_waiting.py index a40fb8983..08329b566 100644 --- a/src/Selenium2Library/keywords/_waiting.py +++ b/src/Selenium2Library/keywords/_waiting.py @@ -45,6 +45,27 @@ def wait_until_page_contains(self, text, timeout=None, error=None): error = "Text '%s' did not appear in " % 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. From d3c009261a231a02b6c203e0eea35b5610aa039b Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Tue, 2 Jun 2015 10:12:49 +0300 Subject: [PATCH 2/3] TEST Adds acceptance test for Wait Until Page Does Not Contain --- test/acceptance/keywords/waiting.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/acceptance/keywords/waiting.txt b/test/acceptance/keywords/waiting.txt index ce7227eb4..5381e8961 100644 --- a/test/acceptance/keywords/waiting.txt +++ b/test/acceptance/keywords/waiting.txt @@ -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 From 41163796cef591ad389a553d4937de2a5ee72bd6 Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Tue, 2 Jun 2015 10:42:43 +0300 Subject: [PATCH 3/3] DOCS Adds changelog entry for Wait Until Page Does Not Contain --- CHANGES.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 12faafcce..0d694dde1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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]