Skip to content

Command Execute Script

ssratkevich edited this page May 12, 2022 · 2 revisions

Supported scripts

Simulate input

Script starting with "input:" prefix supports following commands:

  • ctrl_click - simulate pressing key combo ctrl+click.
    Arguments:
    • element - element on element on which simulated
  • brc_click - simulate pressing click to element center (by bounding rectangle).
    Arguments:
    • element - element on element on which simulated

Examples

element = self.driver.find_element_by_id("ClickedElement")
self.driver.execute_script("input: ctrl_click", element)

Use UI Automation Patterns on element

Script starting with "automation:" prefix supports following commands:

  • ValuePattern.SetValue - sets property on element to specified value. Arguments:
    • element - element on wich attribute will be set
    • value - value to be set
  • ScrollItemPattern.ScrollIntoView and shorthand ScrollIntoView - scroll given element into view.
    Arguments:
    • element - element to show. If element supports ScrollItemPattern pattern this is only required argument
    • scrollableParentElement - parent element which supports ScrollPattern pattern.
  • SelectionItemPattern.Select - select element which supports SelectionItemPattern pattern.
    Arguments:
  • ExpandCollapsePattern.Expand - expands or collapses given element.
    Arguments:
    • element - element which supports ExpandCollapsePattern pattern.
    • expandMode - optional boolean value (default is true) indicating what operation mode:
      • true (default) - expand element
      • false - collapse element
  • SetFocus - sets focus on given element.
    Arguments:
    • element - element which supports setting focus on it (ex.: button, textbox, etc.).

Examples

date_time_picker = self.driver.find_element_by_id("DateTimePicker")
self.driver.execute_script("automation: ValuePattern.SetValue", date_time_picker, "29.06.15 05:00")
Clone this wiki locally