click
Click an element by CSS selector, with integrated waits for page loads, modal opens, or DOM changes—replacing separate wait calls to avoid flaky timing.
Instructions
Click an element by CSS selector.
The wait arguments all run inside THIS call. Reach for them instead of
following a click with a separate wait tool — the extra round-trip costs far
more than the wait. Prefer wait_for / wait_for_predicate / wait_until
over wait_ms: a fixed sleep is either too short (flaky) or too long (slow),
while a condition returns the moment it is satisfied.
Args:
selector: CSS selector for the element to click.
wait_for_navigation: Wait for a page load after clicking (default True).
Set to False for clicks that trigger in-page UI changes
like modals, dropdowns, or expanding sections.
wait_for: CSS selector to wait for AFTER clicking — use this when the click
opens a modal or triggers async UI rendering. The tool waits up to
5 s for the element to appear before returning.
wait_ms: Fixed sleep after the click. Discouraged — use wait_until or
wait_for_predicate, which finish as soon as the page is ready.
wait_for_predicate: JS expression polled (up to 5 s) until it returns
truthy, e.g. "!document.querySelector('.spinner')".
wait_until: Readiness signal — 'dom_settled' (wait for the DOM to stop
changing; the right replacement for wait_ms), 'networkidle',
'load', 'domcontentloaded', 'settle', or 'none'. Defaults to the
historical behaviour: settle unless wait_for was given.
Waits that time out do not fail the click — the click already happened. They
come back in a warnings list so you can see, for instance, that the modal
you expected never opened.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait_ms | No | ||
| selector | Yes | ||
| wait_for | No | ||
| wait_until | No | ||
| wait_for_predicate | No | ||
| wait_for_navigation | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |