Element Exists
Element Exists
Section titled “Element Exists”Type: page-element-exists · Package: Browser v1.0.0 · Output: boolean
Checks whether an element exists and is visible on the page, and returns true or false. Unlike other activities, it does not fail if the element is not there: it simply returns false. It’s the way to handle pages that sometimes show something and sometimes don’t — an error message, a cookie banner, a search result.
How it works
Section titled “How it works”Search for the element by its selector. By default (timeout = 0) it does an immediate check. If you enter a larger timeout, wait until that time for the item to appear before returning false. The result typically feeds an If.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
selector | selector | The item to check. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
page | session | The page session. Omit it inside a body; outside, pass = page. |
timeout | number | Maximum in ms to wait for it to appear. 0 = immediate check (default). |
Output
Section titled “Output”Returns a boolean: true if it exists and is visible, false if not.
Example
Section titled “Example”Close a cookie banner only if it appears:
Page Element Exists selector = (#banner-cookies) → output: hayBannerIf condition = = hayBanner └─ then: Page Click selector = (#aceptar-cookies)