Skip to main content

Capture: element action

Do one action on a captured element: click, type, read text, attributes or all properties, select, check, hover, drag, upload, wait and more. The element is the captured object (properties you choose, each with its own match rule) or a selector.

Command in the Browser toolkit · id ooa.browser/element_action · 26 inputs (1 required), 2 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
Captured objectDictionaryNoThe captured object from Capture in OneAgentStudio: the properties to match (each with use and a match rule: equals, not_equals, contains, starts_with, ends_with, wildcard, regex), search_by (properties, css or xpath), index when several elements match, and iframes. Used instead of the selector when given.
SelectorStringNoElement selector: CSS (#id, .class), text="Sign in", role=button[name="Save"] or xpath=//input[@name='q']. Used when no captured object is given.
ActionStringYesWhat to do with the element. OneAgentStudio lists the actions that suit the captured control type.
ValueAnyNoDepends on the action: the text to type, the key (e.g. Enter, Ctrl+A), the attribute or property name, the option text, value or index, the target selector for drag_to, the file path(s) for upload_file, or the image path for screenshot. Credentials allowed for set_text.
Wait up to (milliseconds)NumberNo30000How long to wait for the element, in milliseconds.
Click methodStringNomousemouse: a real click at the element (scrolls it into view and waits until it can be clicked); javascript: fire the click event directly, for elements that are covered or off screen; debugger: a click sent through the browser's debugging channel with no script put into the page, for sites whose security rules block scripts (G4).
ModifiersStringNoKeys held during the click, e.g. CTRL, SHIFT or CTRL+SHIFT.
Offset xNumberNoClick this many pixels from the element's left edge instead of its centre.
Offset yNumberNoClick this many pixels from the element's top edge instead of its centre.
TypingStringNofillfill: set the whole text at once (fast); keystrokes: type key by key like a person, for fields that react to each key.
Key delay (milliseconds)NumberNo0Pause between keys when typing is keystrokes.
Clear firstBooleanNotrueClear the field before set_text.
ForceBooleanNofalseAct even if the element looks hidden, covered or disabled.
Wait after (milliseconds)NumberNo0Pause after the action, e.g. to let the page react.
Use captured pageBooleanNofalseSwitch to the open tab whose address (and title, when its match rule is set) matches the page recorded with the captured object.
SessionStringNobrowserSession name.
AlternativesDictionaryNoSelf-healing fallbacks recorded with the element (Pick records them): automation_id, name, id, aria_label, tag, class, index, text, relative {anchor, direction}. Tried in that order when the selector finds nothing; the one that works is logged.
WindowDictionaryNoWhich window to act in. Leave empty to use the session's current tab. {"source": "browser", "title": "Invoice * - Shop", "title_match": "wildcard", "url": "...", "url_match": "contains", "browser": "edge"} switches to the first open tab whose title and/or address matches (also in attached browsers, and in one listening on port 9222); {"source": "variable", "variable": "session name"} uses that browser session; {"source": "application", "title": "..."} names a desktop window, which works only when it is a window of an attached browser. Matches: wildcard (default for the title), contains (default for the address), equals or regex; text matches ignore case. Values may use variables.
Wait for page (milliseconds)NumberNo0First wait up to this long for the page to finish loading (0: don't wait). Counts as not found when it runs out.
If not foundStringNoerrorWhen the page or the element is not there in time: error stops with an error; continue skips this step (result is empty) and carries on.
RowNumberNoTable cell actions: the row, 1 for the first.
ColumnNumberNoTable cell actions: the column, 1 for the first.
Run in backgroundBooleanNofalseLeave the browser window where it is: the tab is not brought to the front and clicks are sent to the page (not with the mouse), so other work on the screen can go on.
Find textStringNoclick_cell_by_text and set_cell_by_text: the text of the cell to find (an exact match first, else the first cell containing it) (G4).
Click kindStringNoclickHow a table cell is clicked (G4).
Index from oneBooleanNofalseselect_by_index counts from 1 for the first item, as Get selected index does; off counts from 0 as older steps did (G4).

Outputs​

OutputTypeWhat it is
resultAnyValue returned by get, is, count, wait and coordinate actions.
foundBooleanFalse when the step was skipped because the element was not found (if_not_found = continue).