Skip to content

button

Button(browser, container)

Bases: BaseControl

Entity_Component : Button

Parameters:

Name Type Description Default
browser

The selenium webdriver

required
container

The locator of the container where the control is located in.

required
Source code in pytest_splunk_addon_ui_smartx/components/controls/button.py
28
29
30
31
32
33
def __init__(self, browser, container):
    """
    :param browser: The selenium webdriver
    :param container: The locator of the container where the control is located in.
    """
    super().__init__(browser, container)

click()

Click on the button. Falls back to JavaScript click if the element is intercepted (e.g. CollapsiblePanel toggle buttons in @splunk/react-ui v5).

Source code in pytest_splunk_addon_ui_smartx/components/controls/button.py
35
36
37
38
39
40
41
42
43
def click(self):
    """
    Click on the button. Falls back to JavaScript click if the element is intercepted
    (e.g. CollapsiblePanel toggle buttons in @splunk/react-ui v5).
    """
    try:
        self.container.click()
    except ElementClickInterceptedException:
        self.browser.execute_script("arguments[0].click()", self.container)