19 from selenium.common.exceptions
import StaleElementReferenceException
47 if 'return' not in condition:
48 raise ValueError(
"Condition '%s' did not have mandatory 'return'."
51 lambda: self.
driverdriverdriver.execute_script(condition)
is True,
52 "Condition '%s' did not become true in <TIMEOUT>." % condition,
72 expected = str(expected)
74 "Location did not is '%s' in <TIMEOUT>." % expected,
92 expected = str(expected)
94 "Location did not contain '%s' in <TIMEOUT>." % expected,
109 "Text '%s' did not appear in <TIMEOUT>." % text,
124 "Text '%s' did not disappear in <TIMEOUT>." % text,
140 lambda: self.
find_elementfind_element(locator, required=
False)
is not None,
141 "Element '%s' did not appear in <TIMEOUT>." % locator,
158 lambda: self.
find_elementfind_element(locator, required=
False)
is None,
159 "Element '%s' did not disappear in <TIMEOUT>." % locator,
177 "Element '%s' not visible after <TIMEOUT>." % locator,
194 lambda:
not self.
is_visibleis_visible(locator),
195 "Element '%s' still visible after <TIMEOUT>." % locator,
218 "Element '%s' was not enabled in <TIMEOUT>." % locator,
235 lambda: text
in self.
find_elementfind_element(locator).text,
236 "Element '%s' did not get text '%s' in <TIMEOUT>." % (locator, text),
253 lambda: text
not in self.
find_elementfind_element(locator).text,
254 "Element '%s' still had text '%s' after <TIMEOUT>." % (locator, text),
258 def _wait_until(self, condition, error, timeout=None, custom_error=None):
261 error = error.replace(
'<TIMEOUT>', secs_to_timestr(timeout))
267 max_time = time.time() + timeout
269 while time.time() < max_time:
273 except ElementNotFound
as err:
275 except StaleElementReferenceException
as err:
276 self.
infoinfo(
'Suppressing StaleElementReferenceException from Selenium.')
281 raise AssertionError(not_found
or error)
def is_visible(self, locator)
def find_element(self, locator, tag=None, required=True, parent=None)
Find element matching locator.
def is_text_present(self, text)
def is_element_enabled(self, locator, tag=None)
def info(self, msg, html=False)
def get_timeout(self, timeout=None)
def _wait_until_worker(self, condition, timeout, error)
def _wait_until(self, condition, error, timeout=None, custom_error=None)
def wait_until_element_does_not_contain(self, locator, text, timeout=None, error=None)
Waits until element locator does not contain text.
def wait_until_page_contains_element(self, locator, timeout=None, error=None)
Waits until element locator appears on current page.
def wait_until_element_is_not_visible(self, locator, timeout=None, error=None)
Waits until element locator is not visible.
def wait_until_page_contains(self, text, timeout=None, error=None)
Waits until text appears on current page.
def wait_until_element_is_enabled(self, locator, timeout=None, error=None)
Waits until element locator is enabled.
def wait_until_page_does_not_contain(self, text, timeout=None, error=None)
Waits until text disappears from current page.
def wait_for_condition(self, condition, timeout=None, error=None)
Waits until condition is true or timeout expires.
def wait_until_page_does_not_contain_element(self, locator, timeout=None, error=None)
Waits until element locator disappears from current page.
def wait_until_location_contains(self, expected, timeout=None, message=None)
Wait until that current URL contains expected.
def wait_until_location_is(self, expected, timeout=None, message=None)
Wait until that current URL is expected.
def wait_until_element_contains(self, locator, text, timeout=None, error=None)
Waits until element locator contains text.
def wait_until_element_is_visible(self, locator, timeout=None, error=None)
Waits until element locator is visible.