Puppeteer Frame

View as Markdown

All Frame methods available when using the Puppeteer driver.

Access via frame after launching a Puppeteer runtime.

Every method below is a remote call. The SDK translates it into a structured step sent to a single endpoint:

POST /v1/workspaces/{workspaceId}/execute
1{
2 "runtime": "my-browser",
3 "steps": [
4 {
5 "call": "frame.goto",
6 "args": ["https://example.com"]
7 }
8 ]
9}

The call field maps directly to the method name. args is a JSON array of the method’s arguments. You can batch multiple steps in one request.

goto(url, options?)

Navigate the frame to a URL.

1await frame.goto('...');
ParameterTypeRequiredDescription
urlstringYes
optionsPuppeteerGotoOptionsNo

Returns PuppeteerHTTPResponse \| null

Upstream docs


waitForNavigation(options?)

Wait for navigation to complete.

1await frame.waitForNavigation();
ParameterTypeRequiredDescription
optionsPuppeteerWaitForNavigationOptionsNo

Returns PuppeteerHTTPResponse \| null

Upstream docs


Page Info

url()

The frame’s URL.

1await frame.url();

Returns string

Upstream docs


title()

The frame’s title.

1await frame.title();

Returns string

Upstream docs


content()

The full HTML contents of the frame.

1await frame.content();

Returns string

Upstream docs


setContent(html, options?)

Set the content of the frame.

1await frame.setContent('...');
ParameterTypeRequiredDescription
htmlstringYes
options{ timeout?: number; waitUntil?: string }No

Upstream docs


Actions

click(selector, options?)

Click on an element.

1await frame.click('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPuppeteerClickOptionsNo

Upstream docs


type(selector, text, options?)

Type text into an element.

1await frame.type('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
textstringYes
optionsPuppeteerKeyboardTypeOptionsNo

Upstream docs


focus(selector)

Focus on an element.

1await frame.focus('...');
ParameterTypeRequiredDescription
selectorstringYes

Upstream docs


hover(selector)

Hover over an element.

1await frame.hover('...');
ParameterTypeRequiredDescription
selectorstringYes

Upstream docs


select(selector, …values)

Select options in a <select> element.

1await frame.select('...', /* string[] */);
ParameterTypeRequiredDescription
selectorstringYes
valuesstring[]Yes

Returns string[]

Upstream docs


tap(selector)

Tap on an element.

1await frame.tap('...');
ParameterTypeRequiredDescription
selectorstringYes

Upstream docs


Queries

page()

The page associated with this frame.

Returns the cached page reference passed at construction time.

1frame.page();

Returns RemotePuppeteerPage \| null

Upstream docs


locator(selector)

Creates a Locator for the given selector.

Locators are used for performing actions on elements with built-in waiting.

1frame.locator('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns RemotePuppeteerLocator

Upstream docs


$(selector)

Query for a single element.

1await frame.$('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns RemotePuppeteerElementHandle \| null

Upstream docs


$$(selector)

Query for all matching elements.

1await frame.$$('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns RemotePuppeteerElementHandle[]

Upstream docs


$x(expression)

Evaluate XPath expression. (Uses $$() with xpath prefix internally)

1await frame.$x('...');
ParameterTypeRequiredDescription
expressionstringYes

Returns RemotePuppeteerElementHandle[]

Upstream docs


State Checks

isDetached()

Whether this frame is detached.

@deprecated Use the detached getter.

1frame.isDetached();

Returns boolean

Upstream docs


isMainFrame()

Is this the main frame?

1await frame.isMainFrame();

Returns boolean

Upstream docs


isOOPFrame()

Is this an out-of-process frame? (Deprecated - always returns false)

1await frame.isOOPFrame();

Returns boolean

Upstream docs


Waiting

waitForSelector(selector, options?)

Wait for a selector to appear.

1await frame.waitForSelector('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPuppeteerWaitForSelectorOptionsNo

Returns RemotePuppeteerElementHandle \| null

Upstream docs


waitForFunction(pageFunction, options?, …args)

Wait for a function to return a truthy value.

1await frame.waitForFunction('...');
ParameterTypeRequiredDescription
pageFunctionFunc | stringYes
options{ timeout?: number; polling?: number | 'raf' | 'mutation' }No
argsParamsNo

Returns RemotePuppeteerJSHandle&lt;Awaited&lt;ReturnType&lt;Func&gt;&gt;&gt;

Upstream docs


Evaluation

evaluate(pageFunction, …args)

Evaluate JavaScript in the frame context.

1await frame.evaluate('...');
ParameterTypeRequiredDescription
pageFunctionstring | ((...args: unknown[]) =&gt; T | Promise&lt;T&gt;)Yes
argsunknown[]No

Returns T

Upstream docs


$eval(selector, pageFunction, …args)

Evaluate JavaScript on a selected element.

1await frame.$eval('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
pageFunctionstring | ((el: Element, ...args: unknown[]) =&gt; T | Promise&lt;T&gt;)Yes
argsunknown[]No

Returns T

Upstream docs


$$eval(selector, pageFunction, …args)

Evaluate JavaScript on all matching elements.

1await frame.$$eval('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
pageFunctionstring | ((els: Element[], ...args: unknown[]) =&gt; T | Promise&lt;T&gt;)Yes
argsunknown[]No

Returns T

Upstream docs


evaluateHandle(pageFunction, …args)

Evaluates a function in the frame’s context and returns a handle to the result.

1await frame.evaluateHandle('...');
ParameterTypeRequiredDescription
pageFunctionFunc | stringYes
argsParamsNo

Returns RemotePuppeteerJSHandle&lt;Awaited&lt;ReturnType&lt;Func&gt;&gt;&gt;

Upstream docs


Other

detached()

Is true if the frame has been detached. Otherwise, false.

1frame.detached();

Returns boolean

Upstream docs


frameElement()

The frame element associated with this frame, if any.

Returns the ElementHandle for the <iframe> or <frame> tag for this frame. Returns null for the main frame.

1await frame.frameElement();

Returns RemotePuppeteerElementHandle \| null

Upstream docs


name()

The frame’s name attribute as specified in the tag.

1await frame.name();

Returns string

Upstream docs


parentFrame()

The parent frame, if any.

Returns null for the main frame.

1await frame.parentFrame();

Returns RemotePuppeteerFrame \| null

Upstream docs


childFrames()

Child frames of this frame.

1await frame.childFrames();

Returns RemotePuppeteerFrame[]

Upstream docs


addScriptTag(options)

Add a script tag to the frame.

1await frame.addScriptTag(/* PuppeteerFrameAddScriptTagOptions */);
ParameterTypeRequiredDescription
optionsPuppeteerFrameAddScriptTagOptionsYes

Returns RemotePuppeteerElementHandle

Upstream docs


addStyleTag(options)

Add a style tag to the frame.

1await frame.addStyleTag(/* PuppeteerFrameAddStyleTagOptions */);
ParameterTypeRequiredDescription
optionsPuppeteerFrameAddStyleTagOptionsYes

Returns RemotePuppeteerElementHandle

Upstream docs