pageobject.commands package¶
Submodules¶
pageobject.commands.clear module¶
-
pageobject.commands.clear.
clear
(self, log=True, press_enter=False)¶ Clear the page object.
Parameters: - log (bool) – whether to log or not (defualt is True)
- press_enter (bool) – whether to press enter key after the element is cleared (defualt is False)
Returns: self
Return type: PageObjectBase instance
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.click module¶
-
pageobject.commands.click.
click
(self)¶ Click the page object.
Returns: self
Return type: PageObjectBase instance
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.get_attribute module¶
-
pageobject.commands.get_attribute.
get_attribute
(self, attribute, log=True)¶ Return an attribute value of the page object.
Parameters: - attribute (str) – attribute name
- log (bool) – whether to log or not (default is True)
Returns: attribute value
Return type: str
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.get_value module¶
-
pageobject.commands.get_value.
get_value
(self)¶ Return value of the page object.
Returns: value of the page object
Return type: str
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.index module¶
-
pageobject.commands.index.
index
(self, value)¶ Return index of the first child containing the specified value.
Parameters: value (str) – text value to look for Returns: index of the first child containing the specified value Return type: int Raises: ValueError – if the value is not found
pageobject.commands.is_enabled module¶
-
pageobject.commands.is_enabled.
is_enabled
(self, log=True)¶ Return True if page object is enabled, False otherwise.
Parameters: log (bool) – whether to log or not (defualt is True) Returns: whether page object is enabled Return type: bool
pageobject.commands.is_existing module¶
-
pageobject.commands.is_existing.
is_existing
(self, log=True)¶ Return True if page object exists in the DOM, False otherwise.
Parameters: log (bool) – whether to log or not (default is True) Returns: whether page object exists in the DOM Return type: bool
pageobject.commands.is_visible module¶
-
pageobject.commands.is_visible.
is_visible
(self, log=True)¶ DEPRECATED! Use is_displayed command instead.
pageobject.commands.load module¶
-
pageobject.commands.load.
load
(self, log=True)¶ Load the web page.
Parameters: log (bool) – whether to log or not (defualt is True) Returns: self Return type: PageObjectBase instance
pageobject.commands.move_to module¶
-
pageobject.commands.move_to.
move_to
(self)¶ Move mouse over the page object.
Returns: self
Return type: PageObjectBase instance
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.send_keys module¶
-
pageobject.commands.send_keys.
send_keys
(self, keys, log=True)¶ Send keys to the page object.
Parameters: - keys (iterable of string type) – keys to send to the page object
- log (bool) – whether to log or not (default is True)
Returns: self
Return type: PageObjectBase instance
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.set_value module¶
-
pageobject.commands.set_value.
set_value
(self, value, press_enter=False)¶ Set value of the page object.
Parameters: - value (str) – value to set to the page object
- press_enter (bool) – whether to press enter key after setting the value (default is False)
Returns: self
Return type: PageObjectBase instance
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.text module¶
-
pageobject.commands.text.
text
¶ Return text of the page object.
Returns: text of the page object
Return type: str
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
pageobject.commands.wait_for_enabled module¶
-
pageobject.commands.wait_for_enabled.
wait_for_enabled
(self, timeout=None)¶ DEPRECATED! Use wait_until_enabled command instead.
pageobject.commands.wait_for_exist module¶
-
pageobject.commands.wait_for_exist.
wait_for_exist
(self, timeout=None)¶ DEPRECATED! Use wait_until_existing command instead.
pageobject.commands.wait_for_vanish module¶
-
pageobject.commands.wait_for_vanish.
wait_for_vanish
(self, timeout=None)¶ DEPRECATED! Use wait_until_vanished command instead.
pageobject.commands.wait_for_visible module¶
-
pageobject.commands.wait_for_visible.
wait_for_visible
(self, timeout=None)¶ DEPRECATED! Use wait_until_displayed command instead.
pageobject.commands.wait_until module¶
-
pageobject.commands.wait_until.
wait_until
(self, func, func_args=[], func_kwargs={}, timeout=None, error_msg=None, reverse=False)¶ Wait until a condition is met.
Condition is an arbitrary function with optional args and kwargs that returns bool. If reverse=True, wait until the function returns False, otherwise wait until the function returns True (default).
Parameters: - func (function) – function returning
bool
that is repeatedly invoked until it returns correct value - func_args (list) – list of args to be passed to func
- func_kwargs (dict) – dict of kwargs to be passed to func
- timeout (int) – number of seconds to try to call func, if not provided, PageObject.DEFAULT_WAIT_TIMEOUT is used
- error_msg (str) – error message to attach to the exception raised when the condition is not met in time
- reverse (bool) – flag indicating whether to wait until the condition is True or False
Raises: TimeoutException – if the condition is not met in time
- func (function) – function returning
pageobject.commands.webelement module¶
-
pageobject.commands.webelement.
webelement
¶ Return a webelement instance.
Returns: webelement instance
Return type: selenium.webdriver.remote.webelement.WebElement
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
See also
selenium WebElement documentation (external link)
Module contents¶
-
pageobject.commands.
text
Return text of the page object.
Returns: text of the page object
Return type: str
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
-
pageobject.commands.
text_values
Return list of text values of PageObjectList children.
Returns: index of the first child containing the specified value Returns: list of text values (innerHTML) Return type: list of str
-
pageobject.commands.
webelement
Return a webelement instance.
Returns: webelement instance
Return type: selenium.webdriver.remote.webelement.WebElement
Raises: - NoSuchElementException – if the element cannot be found
- InvalidSelectorException – if the selector is invalid or doesn’t select an element
See also
selenium WebElement documentation (external link)