exists
Check if an element exists on the page. Returns true or false (soft fail).
Signature
const found = await utils.exists(selector, timeout?, frame?)Parameters
| Param | Type | Default | Description |
|---|---|---|---|
selector | string | — | CSS selector or XPath |
timeout | number | 4000 | Max wait time (ms) |
frame | Frame | — | Optional frame to search within |
Examples
if (await utils.exists("#login-btn")) {
await utils.click("#login-btn");
}
// Quick check
const hasCaptcha = await utils.exists(".captcha", 1000);Error Handling
Soft fail — returns false if not found. Does not throw.
Last updated on