Base Component

class pytest_splunk_addon_ui_smartx.components.base_component.ActionChains(browser)[source]

Bases: selenium.webdriver.common.action_chains.ActionChains

Purpose: It is a workaround by wrapping ActionChains class so that key_action.pause is not used in Safari browser.

class pytest_splunk_addon_ui_smartx.components.base_component.BaseComponent(browser, container)[source]

Bases: object

Purpose: The base class for the component. A component is an UI component with which a user interacts with. The component class will have all the interaction method which can be done to the component.

Implementation: - The component will have set of locators. Locators can be of type (ID, CSS_Selector, classname, Name, etc. whichever supported by selenium) - Each method will interact with theses locators directly. - The component should have a container, so that it does not have multiple confusing instances in a same page. - In a container, there should be only one component of the same type.

get_child_element(key)[source]
Get the web-element located inside the container.
  • It is more preferable to use get_child_element over get_element.

  • get_element should only be used if the element is out of the container for some reason. For example, in case of some pop-up.

Note: There is a wait in the method.
param key

The key of the element mentioned in self.elements

returns

The child element of the element searched by key

get_child_elements(key)[source]
Get the list of web-elements located inside the container. Returns empty list of no elements found.
  • It is more preferable to use get_child_elements over get_elements.

  • get_elements should only be used if the element is out of the container for some reason. For example, in case of some pop-up.

Note: There is a wait in the method.
param key

The key of the element mentioned in self.elements

returns

list The child elements of the element searched by key

get_clear_text(web_element)[source]
Gets the text of the web element
param web_element

The instance of the web element we are getting tect from.

returns

str the text of the web elements

get_element(key)[source]

Get the web-element.

Note: There is a wait in get_element.
param key

The key of the element mentioned in self.elements

returns

element The element we are looking for by key

get_elements(key)[source]

Get the list of web-elements.

Note: There is a wait in the method.
param key

The key of the element mentioned in self.elements

returns

list of elements we are searching for by key, or an empty list

get_tuple(key)[source]
get the locator of the element in a tuple form.
param key

The key of the element mentioned in self.elements

returns

Tuple of the locator

hover_over_element(key)[source]
Hover over an element, such as a tooltip, such that other items will appear
param key

The key of the element mentioned in self.elements

wait_for(key, msg=None, timeout=None)[source]

if key in element, Wait for an web element to be visible. Raises TimeoutException if the element not found. if key is a condition, wait for the condition to be true.

param key

The key of the element mentioned in self.elements

param msg

The error-msg which should be mentioned in the TimeoutException

param timeout

The amount of time specified to wait for the wait function

wait_for_text(key, msg=None)[source]
if key in element, Wait for an text in web element to be visible. Raises TimeoutException if the text not element found.
param key

The key of the element mentioned in self.elements

param msg

The error-msg which should be mentioned in the TimeoutException

wait_to_be_clickable(key, msg=None)[source]
Wait for an web element to be invisible. Raises TimeoutException if the element does not dissapear.
param key

The key of the element mentioned in self.elements

param msg

The error-msg which should be mentioned in the TimeoutException

wait_to_display()[source]

Wait for the component container to be displayed

wait_until(key, msg=None)[source]
Wait for an web element to be invisible. Raises TimeoutException if the element does not dissapear.
param key

The key of the element mentioned in self.elements

param msg

The error-msg which should be mentioned in the TimeoutException

class pytest_splunk_addon_ui_smartx.components.base_component.Selector(by, select)

Bases: tuple

property by

Alias for field number 0

property select

Alias for field number 1