Skip to Content

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

ParamTypeDefaultDescription
selectorstring—CSS selector or XPath
timeoutnumber4000Max wait time (ms)
frameFrame—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