Skip to Content
Browser UtilsactiveIframe

activeIframe

Switch scope into an iframe. After calling this, all methods operate inside the iframe.

Signature

const frame = await utils.activeIframe(selector, options?)

Parameters

ParamTypeDefaultDescription
selectorstring—CSS selector or XPath of the iframe
options.waitTimeoutnumber0Max wait time for iframe (ms). Default: instant

Examples

// Instant — iframe must already exist await utils.activeIframe("#my-iframe"); await utils.click("#btn-in-iframe"); await utils.activeMainFrame(); // exit iframe // Wait for iframe to appear await utils.activeIframe("#lazy-iframe", { waitTimeout: 8000 });

Error Handling

Throws if the iframe is not found.

Last updated on