Puppeteer Page

View as Markdown

All Page methods available when using the Puppeteer driver.

Access via runtime.page 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": "page.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 to a URL.

1await runtime.page.goto('...');
ParameterTypeRequiredDescription
urlstringYes
optionsPuppeteerGotoOptionsNo

Returns PuppeteerHTTPResponse \| null — The main resource response, or null if navigating to about:blank.

Upstream docs


reload(options?)

Reload the page.

1await runtime.page.reload();
ParameterTypeRequiredDescription
optionsPuppeteerReloadOptionsNo

Returns PuppeteerHTTPResponse \| null

Upstream docs


goBack(options?)

Navigate back in history.

1await runtime.page.goBack();
ParameterTypeRequiredDescription
optionsPuppeteerWaitForNavigationOptionsNo

Returns PuppeteerHTTPResponse \| null

Upstream docs


goForward(options?)

Navigate forward in history.

1await runtime.page.goForward();
ParameterTypeRequiredDescription
optionsPuppeteerWaitForNavigationOptionsNo

Returns PuppeteerHTTPResponse \| null

Upstream docs


waitForNavigation(options?)

Wait for navigation to complete.

1await runtime.page.waitForNavigation();
ParameterTypeRequiredDescription
optionsPuppeteerWaitForNavigationOptionsNo

Returns PuppeteerHTTPResponse \| null

Upstream docs


Page Info

title()

Get the page title.

1await runtime.page.title();

Returns string

Upstream docs


url()

Get the current URL.

1await runtime.page.url();

Returns string

Upstream docs


content()

Get the full HTML content.

1await runtime.page.content();

Returns string

Upstream docs


setContent(html, options?)

Set the page content.

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

Upstream docs


setViewport(viewport)

Set the viewport size. Pass null to reset to default.

1await runtime.page.setViewport(/* viewport */);
ParameterTypeRequiredDescription
viewportPuppeteerViewport | nullYes

Upstream docs


viewport()

Get the current viewport.

1await runtime.page.viewport();

Returns PuppeteerViewport \| null

Upstream docs


Actions

click(selector, options?)

Click on an element matching the selector.

1await runtime.page.click('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPuppeteerClickOptionsNo

Upstream docs


type(selector, text, options?)

Type text into an element.

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

Upstream docs


focus(selector)

Focus on an element.

1await runtime.page.focus('...');
ParameterTypeRequiredDescription
selectorstringYes

Upstream docs


hover(selector)

Hover over an element.

1await runtime.page.hover('...');
ParameterTypeRequiredDescription
selectorstringYes

Upstream docs


select(selector, …values)

Select options in a <select> element.

1await runtime.page.select('...', /* values */);
ParameterTypeRequiredDescription
selectorstringYes
values(string | PuppeteerSelectValue)[]Yes

Returns string[]

Upstream docs


tap(selector)

Tap on an element (for touch devices).

1await runtime.page.tap('...');
ParameterTypeRequiredDescription
selectorstringYes

Upstream docs


Queries

$(selector)

Query for a single element.

1await runtime.page.$('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns RemotePuppeteerElementHandle \| null

Upstream docs


$$(selector)

Query for all matching elements.

1await runtime.page.$$('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns RemotePuppeteerElementHandle[]

Upstream docs


$x(expression)

Evaluate XPath expression.

1await runtime.page.$x('...');
ParameterTypeRequiredDescription
expressionstringYes

Returns RemotePuppeteerElementHandle[]

Upstream docs


locator(selector)

Create a locator for the given selector.

1runtime.page.locator('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns RemotePuppeteerLocator

Upstream docs


Content

textContent(selector)

Get the text content of an element matching the selector.

1await runtime.page.textContent('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns string \| null


innerHTML(selector)

Get the inner HTML of an element matching the selector.

1await runtime.page.innerHTML('...');
ParameterTypeRequiredDescription
selectorstringYes

Returns string


State Checks

isJavaScriptEnabled()

Check if JavaScript is enabled.

1await runtime.page.isJavaScriptEnabled();

Returns boolean

Upstream docs


isDragInterceptionEnabled()

Check if drag interception is enabled.

1runtime.page.isDragInterceptionEnabled();

Returns boolean

Upstream docs


isServiceWorkerBypassed()

Check if service worker bypass is enabled.

1await runtime.page.isServiceWorkerBypassed();

Returns boolean

Upstream docs


Waiting

waitForSelector(selector, options?)

Wait for a selector to appear in the DOM.

1await runtime.page.waitForSelector('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPuppeteerWaitForOptionsNo

Returns RemotePuppeteerElementHandle \| null

Upstream docs


waitForTimeout(milliseconds)

Wait for a timeout.

Deprecated: Use await new Promise(r =&gt; setTimeout(r, ms)) instead.

1await runtime.page.waitForTimeout(0);
ParameterTypeRequiredDescription
millisecondsnumberYes

Upstream docs


waitForFunction(pageFunction, options?, …args)

Wait for a function to return true.

1await runtime.page.waitForFunction('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
options{ timeout?: number; polling?: number | "raf" }No
argsunknown[]No

Upstream docs


waitForNetworkIdle(options?)

Wait for network to be idle.

1await runtime.page.waitForNetworkIdle();
ParameterTypeRequiredDescription
optionsPuppeteerWaitForNetworkIdleOptionsNo

Upstream docs


waitForFrame(urlOrPredicate, options?)

Wait for a frame to appear.

Note: Predicate functions are not supported in RPC mode. Use URL string instead.

1await runtime.page.waitForFrame('...');
ParameterTypeRequiredDescription
urlOrPredicatestringYes
options{ timeout?: number }No

Returns RemotePuppeteerFrame

Upstream docs


waitForFileChooser(options?)

Wait for a file chooser to appear.

1await runtime.page.waitForFileChooser();
ParameterTypeRequiredDescription
options{ timeout?: number }No

Returns RemotePuppeteerFileChooser

Upstream docs


waitForRequest(urlOrPredicate, options?)

Wait for a specific request.

Note: Predicate functions are not supported in RPC mode. Use URL string instead.

1await runtime.page.waitForRequest('...');
ParameterTypeRequiredDescription
urlOrPredicatestringYes
options{ timeout?: number }No

Returns PuppeteerHTTPRequest

Upstream docs


waitForResponse(urlOrPredicate, options?)

Wait for a specific response.

Note: Predicate functions are not supported in RPC mode. Use URL string instead.

1await runtime.page.waitForResponse('...');
ParameterTypeRequiredDescription
urlOrPredicatestringYes
options{ timeout?: number }No

Returns PuppeteerHTTPResponse

Upstream docs


waitForDevicePrompt(options?)

Wait for a device prompt (e.g., Bluetooth, USB).

1await runtime.page.waitForDevicePrompt();
ParameterTypeRequiredDescription
options{ timeout?: number }No

Returns { devices: Array&lt;{ name: string; id: string }&gt;; select: (deviceId: string) =&gt; Promise&lt;void&gt;; cancel: () =&gt; Promise&lt;void&gt; }

Upstream docs


Screenshots & PDF

screenshot(options?)

Take a screenshot (returns base64 string or Buffer).

1await runtime.page.screenshot();
ParameterTypeRequiredDescription
optionsPuppeteerScreenshotOptionsNo

Returns string \| Buffer

Upstream docs


pdf(options?)

Generate a PDF (returns base64 string or Buffer).

1await runtime.page.pdf();
ParameterTypeRequiredDescription
optionsPuppeteerPDFOptionsNo

Returns string \| Buffer

Upstream docs


Evaluation

evaluate(pageFunction, …args)

Evaluate JavaScript in the page context.

1await runtime.page.evaluate('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
argsunknown[]No

Returns T

Upstream docs


$eval(selector, pageFunction, …args)

Evaluate JavaScript on a selected element.

1await runtime.page.$eval('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
pageFunctionFunction | stringYes
argsunknown[]No

Returns T

Upstream docs


$$eval(selector, pageFunction, …args)

Evaluate JavaScript on all matching elements.

1await runtime.page.$$eval('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
pageFunctionFunction | stringYes
argsunknown[]No

Returns T

Upstream docs


evaluateHandle(pageFunction, …args)

Evaluate handle (returns a JSHandle).

Note: Handles are not fully supported in RPC mode - use evaluate instead.

1await runtime.page.evaluateHandle('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
argsunknown[]No

Returns unknown

Upstream docs


evaluateOnNewDocument(pageFunction, …args)

Add a script to evaluate when a new document is created.

1await runtime.page.evaluateOnNewDocument('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
argsunknown[]No

Returns { identifier: string }

Upstream docs


Cookies

cookies(…urls)

Get all cookies.

1await runtime.page.cookies();
ParameterTypeRequiredDescription
urlsstring[]No

Returns PuppeteerCookie[]

Upstream docs


setCookie(…cookies)

Set cookies.

1await runtime.page.setCookie(/* PuppeteerCookie[] */);
ParameterTypeRequiredDescription
cookiesPuppeteerCookie[]Yes

Upstream docs


deleteCookie(…cookies)

Delete cookies.

1await runtime.page.deleteCookie(/* PuppeteerCookie[] */);
ParameterTypeRequiredDescription
cookiesPuppeteerCookie[]Yes

Upstream docs


Lifecycle

bringToFront()

Bring page to front.

1await runtime.page.bringToFront();

Upstream docs


close()

Close the page.

1await runtime.page.close();

Upstream docs


Other

emulateMediaType(type?)

Emulate media type.

1await runtime.page.emulateMediaType();
ParameterTypeRequiredDescription
type'screen' | 'print' | nullNo

Upstream docs


emulateMediaFeatures(features?)

Emulate media features.

1await runtime.page.emulateMediaFeatures();
ParameterTypeRequiredDescription
featuresArray&lt;{ name: string; value: string }&gt;No

Upstream docs


emulateTimezone(timezoneId?)

Emulate timezone.

1await runtime.page.emulateTimezone();
ParameterTypeRequiredDescription
timezoneIdstringNo

Upstream docs


emulateVisionDeficiency(type?)

Emulate vision deficiency.

1await runtime.page.emulateVisionDeficiency();
ParameterTypeRequiredDescription
type'none' | 'achromatopsia' | 'deuteranopia' | 'protanopia' | 'tritanopia' | 'blurredVision'No

Upstream docs


setGeolocation(geolocation)

Set geolocation.

1await runtime.page.setGeolocation(/* PuppeteerGeolocation */);
ParameterTypeRequiredDescription
geolocationPuppeteerGeolocationYes

Upstream docs


setUserAgent(userAgent)

Set user agent.

1await runtime.page.setUserAgent('...');
ParameterTypeRequiredDescription
userAgentstringYes

Upstream docs


setExtraHTTPHeaders(headers)

Set extra HTTP headers.

1await runtime.page.setExtraHTTPHeaders(/* Record<string, string> */);
ParameterTypeRequiredDescription
headersRecord&lt;string, string&gt;Yes

Upstream docs


createCDPSession()

Create a CDP session.

Note: Returns a session identifier in RPC mode (not a live CDPSession).

1await runtime.page.createCDPSession();

Returns { sessionId: string }

Upstream docs


sendCDP(method, params?)

Send a CDP command directly.

1await runtime.page.sendCDP('...');
ParameterTypeRequiredDescription
methodstringYes
paramsRecord&lt;string, unknown&gt;No

Returns T


metrics()

Get metrics.

1await runtime.page.metrics();

Returns Record&lt;string, number&gt;

Upstream docs


setJavaScriptEnabled(enabled)

Set JavaScript enabled/disabled.

1await runtime.page.setJavaScriptEnabled(true);
ParameterTypeRequiredDescription
enabledbooleanYes

Upstream docs


setCacheEnabled(enabled)

Set cache enabled/disabled.

1await runtime.page.setCacheEnabled(true);
ParameterTypeRequiredDescription
enabledbooleanYes

Upstream docs


setOfflineMode(enabled)

Set offline mode.

1await runtime.page.setOfflineMode(true);
ParameterTypeRequiredDescription
enabledbooleanYes

Upstream docs


emulateNetworkConditions(conditions)

Emulate network conditions.

1await runtime.page.emulateNetworkConditions(/* conditions */);
ParameterTypeRequiredDescription
conditions{ offline: boolean; downloadThroughput: number; uploadThroughput: number; latency: number } | nullYes

Upstream docs


addScriptTag(options)

Add script tag.

1await runtime.page.addScriptTag(/* { url?: string; path?: string; content?: string; type?: string } */);
ParameterTypeRequiredDescription
options{ url?: string; path?: string; content?: string; type?: string }Yes

Returns PuppeteerSerializedElement

Upstream docs


addStyleTag(options)

Add style tag.

1await runtime.page.addStyleTag(/* { url?: string; path?: string; content?: string } */);
ParameterTypeRequiredDescription
options{ url?: string; path?: string; content?: string }Yes

Returns PuppeteerSerializedElement

Upstream docs


setRequestInterception(enabled)

Set request interception enabled/disabled.

1await runtime.page.setRequestInterception(true);
ParameterTypeRequiredDescription
enabledbooleanYes

Upstream docs


authenticate(credentials)

Authenticate with HTTP auth.

1await runtime.page.authenticate(/* credentials */);
ParameterTypeRequiredDescription
credentials{ username: string; password: string } | nullYes

Upstream docs


mainFrame()

Get the main frame.

1runtime.page.mainFrame();

Returns RemotePuppeteerFrame

Upstream docs


frames()

Get all frames.

1await runtime.page.frames();

Returns RemotePuppeteerFrame[]

Upstream docs


setDefaultNavigationTimeout(timeout)

Set the default navigation timeout.

1await runtime.page.setDefaultNavigationTimeout(0);
ParameterTypeRequiredDescription
timeoutnumberYes

Upstream docs


setDefaultTimeout(timeout)

Set the default timeout.

1await runtime.page.setDefaultTimeout(0);
ParameterTypeRequiredDescription
timeoutnumberYes

Upstream docs


getDefaultNavigationTimeout()

Get the default navigation timeout.

1runtime.page.getDefaultNavigationTimeout();

Returns number


getDefaultTimeout()

Get the default timeout.

1runtime.page.getDefaultTimeout();

Returns number


setBypassCSP(enabled)

Toggle bypassing Content-Security-Policy.

1await runtime.page.setBypassCSP(true);
ParameterTypeRequiredDescription
enabledbooleanYes

Upstream docs


removeScriptToEvaluateOnNewDocument(identifier)

Remove an injected script.

1await runtime.page.removeScriptToEvaluateOnNewDocument('...');
ParameterTypeRequiredDescription
identifierstringYes

Upstream docs


removeExposedFunction(name)

Remove an exposed function.

1await runtime.page.removeExposedFunction('...');
ParameterTypeRequiredDescription
namestringYes

Upstream docs


emulate(device)

Emulate a device (viewport + user agent).

1await runtime.page.emulate(/* PuppeteerDevice */);
ParameterTypeRequiredDescription
devicePuppeteerDeviceYes

Upstream docs


emulateCPUThrottling(factor)

Emulate CPU throttling.

1await runtime.page.emulateCPUThrottling(/* factor */);
ParameterTypeRequiredDescription
factornumber | nullYes

Upstream docs


emulateIdleState(overrides?)

Emulate idle state.

1await runtime.page.emulateIdleState();
ParameterTypeRequiredDescription
overridesPuppeteerIdleOverridesNo

Upstream docs


setBypassServiceWorker(bypass)

Set service worker bypass.

1await runtime.page.setBypassServiceWorker(true);
ParameterTypeRequiredDescription
bypassbooleanYes

Upstream docs


setDragInterception(enabled)

Set drag interception.

1await runtime.page.setDragInterception(true);
ParameterTypeRequiredDescription
enabledbooleanYes

Upstream docs


target()

Get the target for this page.

1await runtime.page.target();

Returns PuppeteerTarget

Upstream docs


workers()

Get all web workers for this page.

1await runtime.page.workers();

Returns PuppeteerWebWorker[]

Upstream docs


windowId()

Get the window ID.

1await runtime.page.windowId();

Returns number


resize(options)

Resize the page.

1await runtime.page.resize(/* { width: number; height: number } */);
ParameterTypeRequiredDescription
options{ width: number; height: number }Yes

queryObjects(prototypeHandle)

Query all objects of a given prototype.

1await runtime.page.queryObjects(/* RemotePuppeteerElementHandle */);
ParameterTypeRequiredDescription
prototypeHandleRemotePuppeteerElementHandleYes

Returns RemotePuppeteerElementHandle

Upstream docs


openDevTools(options?)

Open DevTools. Only works in headful mode.

1await runtime.page.openDevTools();
ParameterTypeRequiredDescription
options{ docking?: 'right' | 'bottom' | 'left' | 'undocked' }No

Upstream docs


Mouse

mouse.click(x, y, options?)

Click at specific coordinates.

1await runtime.page.mouse.click(0, 0);
ParameterTypeRequiredDescription
xnumberYes
ynumberYes
optionsPuppeteerMouseClickOptionsNo

mouse.move(x, y, options?)

Move mouse to specific coordinates.

1await runtime.page.mouse.move(0, 0);
ParameterTypeRequiredDescription
xnumberYes
ynumberYes
optionsPuppeteerMouseMoveOptionsNo

mouse.down(options?)

Press mouse button down.

1await runtime.page.mouse.down();
ParameterTypeRequiredDescription
optionsPuppeteerMouseOptionsNo

mouse.up(options?)

Release mouse button.

1await runtime.page.mouse.up();
ParameterTypeRequiredDescription
optionsPuppeteerMouseOptionsNo

mouse.wheel(options?)

Scroll mouse wheel.

1await runtime.page.mouse.wheel();
ParameterTypeRequiredDescription
optionsPuppeteerMouseWheelOptionsNo

mouse.drag(start, target)

Dispatches a drag event.

1await runtime.page.mouse.drag(/* PuppeteerPoint */, /* PuppeteerPoint */);
ParameterTypeRequiredDescription
startPuppeteerPointYes
targetPuppeteerPointYes

Returns PuppeteerDragData


mouse.dragAndDrop(start, target, options?)

Perform a drag and drop operation.

1await runtime.page.mouse.dragAndDrop(/* PuppeteerPoint */, /* PuppeteerPoint */);
ParameterTypeRequiredDescription
startPuppeteerPointYes
targetPuppeteerPointYes
options{ delay?: number }No

mouse.dragEnter(target, data)

Dispatches a dragenter event.

1await runtime.page.mouse.dragEnter(/* PuppeteerPoint */, /* PuppeteerDragData */);
ParameterTypeRequiredDescription
targetPuppeteerPointYes
dataPuppeteerDragDataYes

mouse.dragOver(target, data)

Dispatches a dragover event.

1await runtime.page.mouse.dragOver(/* PuppeteerPoint */, /* PuppeteerDragData */);
ParameterTypeRequiredDescription
targetPuppeteerPointYes
dataPuppeteerDragDataYes

mouse.drop(target, data)

Performs a dragenter, dragover, and drop in sequence.

1await runtime.page.mouse.drop(/* PuppeteerPoint */, /* PuppeteerDragData */);
ParameterTypeRequiredDescription
targetPuppeteerPointYes
dataPuppeteerDragDataYes

mouse.reset()

Resets the mouse to the default state.

1await runtime.page.mouse.reset();

Keyboard

keyboard.down(key, options?)

Dispatches a keydown event.

If key is a single character and no modifier keys besides Shift are being held down, a keypress/input event will also be generated. The text option can be specified to force an input event to be generated.

Modifier keys DO affect keyboard.down. Holding down Shift will type the text in upper case.

1await runtime.page.keyboard.down(/* PuppeteerKeyInput */);
ParameterTypeRequiredDescription
keyPuppeteerKeyInputYesName of key to press, such as ArrowLeft.
optionsPuppeteerKeyDownOptionsNoOptions for the key down event.

Upstream docs


keyboard.up(key)

Dispatches a keyup event.

1await runtime.page.keyboard.up(/* PuppeteerKeyInput */);
ParameterTypeRequiredDescription
keyPuppeteerKeyInputYesName of key to release, such as ArrowLeft.

Upstream docs


keyboard.press(key, options?)

Shortcut for Keyboard.down and Keyboard.up.

If key is a single character and no modifier keys besides Shift are being held down, a keypress/input event will also be generated. The text option can be specified to force an input event to be generated.

Modifier keys DO affect keyboard.press. Holding down Shift will type the text in upper case.

1await runtime.page.keyboard.press(/* PuppeteerKeyInput */);
ParameterTypeRequiredDescription
keyPuppeteerKeyInputYesName of key to press, such as ArrowLeft.
optionsPuppeteerKeyPressOptionsNoOptions for the key press event including delay, text, and commands.

Upstream docs


keyboard.sendCharacter(char)

Dispatches a keypress and input event. This does not send a keydown or keyup event.

Modifier keys DO NOT affect keyboard.sendCharacter. Holding down Shift will not type the text in upper case.

1await runtime.page.keyboard.sendCharacter('...');
ParameterTypeRequiredDescription
charstringYesCharacter to send into the page.

Upstream docs


keyboard.type(text, options?)

Sends a keydown, keypress/input, and keyup event for each character in the text.

To press a special key, like Control or ArrowDown, use Keyboard.press.

Modifier keys DO NOT affect keyboard.type. Holding down Shift will not type the text in upper case.

1await runtime.page.keyboard.type('...');
ParameterTypeRequiredDescription
textstringYesA text to type into a focused element.
optionsPuppeteerKeyboardTypeOptionsNoOptions for typing including delay between key presses.

Upstream docs


Touchscreen

touchscreen.tap(x, y)

Dispatches a touchstart and touchend event (simulates a tap).

1await runtime.page.touchscreen.tap(0, 0);
ParameterTypeRequiredDescription
xnumberYes
ynumberYes

Upstream docs


touchscreen.touchStart(x, y)

Dispatches a touchstart event.

Returns a TouchHandle that can be used to dispatch touchMove and touchEnd events for this specific touch point. This allows tracking individual touches in multi-touch scenarios.

The returned TouchHandle has:

  • move(x, y): Dispatches a touchmove event for this touch
  • end(): Dispatches a touchend event for this touch
1Performing a swipe gesture:
2```ts
3const touch = await page.touchscreen.touchStart(100, 100);
4await touch.move(200, 100);
5await touch.move(300, 100);
6await touch.end();
| Parameter | Type | Required | Description |
|---|---|---|---|
| `x` | `number` | Yes | — |
| `y` | `number` | Yes | — |
**Returns** `TouchHandle`
— A TouchHandle for controlling this touch point.
[Upstream docs](https://pptr.dev/api/puppeteer.touchscreen.touchstart)
---
### touchscreen.touchMove(x, y)
Dispatches a `touchmove` event on the active touch.
<Note>
Note: Not every `touchMove` call results in a `touchmove` event being emitted,
depending on the browser's optimizations.
For more precise control over individual touches, use `touchStart()` which returns
a TouchHandle with its own `move()` method.
</Note>
```ts
await runtime.page.touchscreen.touchMove(0, 0);
ParameterTypeRequiredDescription
xnumberYes
ynumberYes

Upstream docs


touchscreen.touchEnd()

Dispatches a touchend event.

1await runtime.page.touchscreen.touchEnd();

Upstream docs