webdriver_test_tools.webdriver.support.test module¶
Functions for commonly repeated test procedures
-
webdriver_test_tools.webdriver.support.test.
expected_condition_test
(driver, ec_object, wait_timeout=10)[source]¶ Test for an expected condition until wait timeout is reached
- Parameters
driver – Selenium WebDriver object
ec_object – Expected condition object
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out
- Returns
True if expected condition occurred, otherwise False
-
webdriver_test_tools.webdriver.support.test.
in_view_change_test
(driver, target_locator, wait_timeout=10)[source]¶ Expected condition test for an element to scroll into view (e.g. same-page link with scroll animation)
- Parameters
driver – Selenium WebDriver object
target_locator – Tuple in the format (by,selector) used to locate target
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out
- Returns
True if target is scrolled into view before timeout, False otherwise
-
webdriver_test_tools.webdriver.support.test.
visibility_change_test
(driver, target_locator, test_visible=True, wait_timeout=10)[source]¶ Expected condition test for visibility changes (e.g. modals)
- Parameters
driver – Selenium WebDriver object
target_locator – Tuple in the format (by,selector) used to locate target
test_visible – (Default=True) An optional variable describing what the visibility change is supposed to be. If True, test if the target becomes visible. If False, test if the target becomes invisible
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out
- Returns
True if the target’s visibily changes as expected, False otherwise
-
webdriver_test_tools.webdriver.support.test.
url_change_test
(driver, expected_url, wait_timeout=10)[source]¶ Expected condition test for URL change
- Parameters
driver – Selenium WebDriver object
expected_url – The expected URL
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out
- Returns
True if the current URL matches the expected URL before timeout, False otherwise
-
webdriver_test_tools.webdriver.support.test.
base_url_change_test
(driver, expected_url, ignore_trailing_slash=True, wait_timeout=10)[source]¶ Expected condition test for URL change. Ignores query strings in current url
- Parameters
driver – Selenium WebDriver object
expected_url – The expected base URL
ignore_trailing_slash – (Default = True) If True, ignore trailing ‘/’ in the expected url and current base URL when comparing
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out
- Returns
True if the current URL (ignoring query strings) matches the expected URL before timeout, False otherwise
-
webdriver_test_tools.webdriver.support.test.
existence_change_test
(driver, target_locator, test_exists=True, wait_timeout=10)[source]¶ Expected condition test for element existence changes (e.g. element that gets added/removed dynamically)
- Parameters
driver – Selenium WebDriver object
target_locator – Tuple in the format (by,selector) used to locate target
test_exists – (Default = True) An optional variable describing what the existence change is supposed to be. If True, test if the target does exist. If False, test if the target no longer exists
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out
- Returns
True if the existence of the target changes as expected, False otherwise
-
webdriver_test_tools.webdriver.support.test.
enabled_state_change_test
(driver, target_locator, test_enabled=True, wait_timeout=10)[source]¶ Expected condition test for element enabled/disabled state changes
- Parameters
driver – Selenium WebDriver object
target_locator – Tuple in the format (by,selector) used to locate target
test_enabled – (Default = True) An optional variable describing what the enabled/disabled state change is supposed to be. If True, test if the target is enabled. If False, test if the target is disabled
wait_timeout – (Default = 10) Number of seconds to wait for expected conditions to occur before timing out