Click
Type: page-click · Package: Browser v1.0.9 · Output: ZoanPageSession
Clicks an element on the page (a button, a link, a checkbox). It is the most common interaction activity: anything you would do with the mouse in the browser. If the click opens a new tab, it can wait for it and return its session so you can keep working there.
How it works
Section titled “How it works”It locates the element given by the selector, waits until it is actionable (visible, stable, enabled and not covered by another element; it scrolls it into view if needed) and clicks it. If it can’t within timeout, the activity fails with a message that explains the cause. You can choose the mouse button and the number of clicks (for a double click).
Clicks that open a new tab
Section titled “Clicks that open a new tab”With expectNewTab = true, the activity starts listening before clicking, so the tab isn’t missed even if it appears instantly:
- It clicks.
- It waits up to
newTabTimeoutfor the new tab to open (atarget="_blank", a pop-up window). - It waits for its HTML to be loaded (
DOMContentLoaded) and returns it as the output.
Without this option, the tab still opens but the playbook doesn’t have it at hand; you would have to find it later with Switch Page.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The element to click. Capture it with the visual selector or write a CSS selector. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page | ZoanPageSession | — | The page session. Omit it inside a body; outside, pass the session variable (e.g. page = page). |
button | string | "left" | Mouse button: left · right · middle. |
clickCount | int | 1 | Number of clicks: 1 (click) · 2 (double click). |
timeout | number | 30000 | Maximum time in ms to wait for the element to be actionable. Empty, 0 or negative: the project settings value or, if none, 30000. |
expectNewTab | bool | false | The click opens a new tab: it waits for it and returns it as the output. |
newTabTimeout | number | 15000 | Maximum time in ms to wait for the new tab (only with expectNewTab). 0 or negative: the default. |
Output
Section titled “Output”- With
expectNewTab = true: aZoanPageSessionfor the new tab, tied to the same browser (it shares cookies and the signed-in state with the original tab). The original tab stays open and its session keeps working. - Without
expectNewTab: it doesn’t return a value.
Example
Section titled “Example”Page Click selector = (#botonGuardar)Page Click selector = (.fila-resultado) clickCount = 2 // double clickPage Click selector = (#menu) button = right // right clickOpen an order detail that is shown in another tab and read its status:
Page Click page = page selector = (#verDetalle) expectNewTab = true → output: detallePage Get Text page = detalle selector = (.estado) → output: estadoClose Page page = detalleCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Click failed: Timeout 30000ms exceeded. … | matches: 0 (element not found: …) | The selector didn’t find the element: the page hadn’t finished loading, it’s inside an iframe or the selector is outdated. Recapture the selector or add a Wait For before it. |
Click failed: … | matches: 1 (the element exists but the action did not complete: …) | The element is hidden, disabled or covered (a modal, a cookie banner). Close whatever covers it or wait for it to be enabled. |
Click failed: … | matches: 3 (the selector is ambiguous: …) | The selector matches several elements. Use a more specific selector (id, unique text), an index or an anchor. |
Timeout 15000ms exceeded … waiting for the new tab | With expectNewTab, the click didn’t open any tab in time (or opened it in the same tab). Raise newTabTimeout, or remove expectNewTab if the link navigates in the same tab. |
'page' must be a ZoanPageSession. | There is no page and the activity isn’t inside a body. Pass page = page. |
Related activities
Section titled “Related activities”- Hover — move the mouse over an element without clicking (drop-down menus).
- Wait For — make sure the element is ready.
- Element Exists — check whether the element is there before acting.
- Switch Page — take a tab opened by other means.