Check whether an element exists
Check whether an element exists
Checks whether an element is on the browser's page and returns true or false. Useful for branching the flow on an element's presence. This action never fails because the element is missing — it returns false instead.
Options
Browser or page ID
The browser, tab or iframe opening action where the check happens.
Element selector
The CSS selector of the element being checked for, .div/class for example. The Roberty Automation extension can fill it in for you.
Advanced options
Element state
The state the element has to be in to count as existing: Visible, Invisible/hidden, Present in the DOM or Not present in the DOM. Default: Visible.
Timeout
How long, in seconds, the robot waits for the element to reach that state. Default: 20.
Returns
Javascript code
js
actions["action-id"].exists // whether the element was found — true or false (Boolean)
Field selection
- exists — whether the element was found in the state you set (Boolean)
Rules and conditions
- Browser or page ID and Element selector are both required.
- This action never fails because the element is missing — it returns
false. - Use the exists output in a condition to branch the robot's flow on whether the element is there.