Skip to content

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.

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).

With expectNewTab = true, the activity starts listening before clicking, so the tab isn’t missed even if it appears instantly:

  1. It clicks.
  2. It waits up to newTabTimeout for the new tab to open (a target="_blank", a pop-up window).
  3. 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.

ParameterTypeDefaultDescription
selectorselector—The element to click. Capture it with the visual selector or write a CSS selector.
ParameterTypeDefaultDescription
pageZoanPageSession—The page session. Omit it inside a body; outside, pass the session variable (e.g. page = page).
buttonstring"left"Mouse button: left · right · middle.
clickCountint1Number of clicks: 1 (click) · 2 (double click).
timeoutnumber30000Maximum time in ms to wait for the element to be actionable. Empty, 0 or negative: the project settings value or, if none, 30000.
expectNewTabboolfalseThe click opens a new tab: it waits for it and returns it as the output.
newTabTimeoutnumber15000Maximum time in ms to wait for the new tab (only with expectNewTab). 0 or negative: the default.
  • With expectNewTab = true: a ZoanPageSession for 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.
Page Click selector = (#botonGuardar)
Page Click selector = (.fila-resultado) clickCount = 2 // double click
Page Click selector = (#menu) button = right // right click

Open an order detail that is shown in another tab and read its status:

Page Click page = page selector = (#verDetalle) expectNewTab = true → output: detalle
Page Get Text page = detalle selector = (.estado) → output: estado
Close Page page = detalle
MessageCause 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 tabWith 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.
  • 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.