Playwright Page

View as Markdown

All Page methods available when using the Playwright driver.

Access via runtime.page after launching a Playwright 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
optionsPlaywrightGotoOptionsNo

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

Upstream docs


reload(options?)

Reload the page.

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

Returns PlaywrightResponse \| null

Upstream docs


goBack(options?)

Navigate back in history.

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

Returns PlaywrightResponse \| null

Upstream docs


goForward(options?)

Navigate forward in history.

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

Returns PlaywrightResponse \| null

Upstream docs


waitForURL(url, options?)

Wait for the main frame to navigate to the given URL.

1await runtime.page.waitForURL(/* url */);
ParameterTypeRequiredDescription
urlstring | RegExp | ((url: URL) => boolean)Yes
optionsPlaywrightWaitForURLOptionsNo

Upstream docs


waitForLoadState(state?, options?)

Wait for the required load state to be reached.

State can be ‘load’, ‘domcontentloaded’, or ‘networkidle’.

1await runtime.page.waitForLoadState();
ParameterTypeRequiredDescription
stateLoadStateNo
optionsPlaywrightWaitForLoadStateOptionsNo

Upstream docs


waitForNavigation(options?)

Wait for the main frame navigation and return the main resource response.

Deprecated: This method is inherently racy. Use page.waitForURL() instead.

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

Returns PlaywrightResponse \| 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 of the page.

1await runtime.page.content();

Returns string

Upstream docs


setContent(html, options?)

Set the HTML content of the page.

1await runtime.page.setContent('...');
ParameterTypeRequiredDescription
htmlstringYes
optionsPlaywrightSetContentOptionsNo

Upstream docs


setViewportSize(viewportSize)

Set the viewport size.

1await runtime.page.setViewportSize(/* PlaywrightViewportSize */);
ParameterTypeRequiredDescription
viewportSizePlaywrightViewportSizeYes

Upstream docs


viewportSize()

Get the viewport size.

1runtime.page.viewportSize();

Returns PlaywrightViewportSize \| null

Upstream docs


isClosed()

Check if the page is closed.

1runtime.page.isClosed();

Returns boolean

Upstream docs


Actions

click(selector, options?)

Click on an element matching the selector.

Deprecated: Use locator.click() instead.

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

Upstream docs


dblclick(selector, options?)

Double-click on an element matching the selector.

Deprecated: Use locator.dblclick() instead.

1await runtime.page.dblclick('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPlaywrightDblclickOptionsNo

Upstream docs


fill(selector, value, options?)

Fill an input element with the given value.

Deprecated: Use locator.fill() instead.

1await runtime.page.fill('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
valuestringYes
optionsPlaywrightFillOptionsNo

Upstream docs


type(selector, text, options?)

Type text into an element (sends keydown, keypress/input, keyup events for each character).

Deprecated: Use locator.pressSequentially() instead.

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

Upstream docs


press(selector, key, options?)

Focus an element and press a key combination.

Deprecated: Use locator.press() instead.

1await runtime.page.press('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
keystringYes
optionsPlaywrightPressOptionsNo

Upstream docs


hover(selector, options?)

Hover over an element.

Deprecated: Use locator.hover() instead.

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

Upstream docs


focus(selector, options?)

Focus on an element.

Deprecated: Use locator.focus() instead.

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

Upstream docs


tap(selector, options?)

Tap on an element (for touch devices).

Deprecated: Use locator.tap() instead.

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

Upstream docs


check(selector, options?)

Check a checkbox or radio button.

Deprecated: Use locator.check() instead.

1await runtime.page.check('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPlaywrightCheckOptionsNo

Upstream docs


uncheck(selector, options?)

Uncheck a checkbox.

Deprecated: Use locator.uncheck() instead.

1await runtime.page.uncheck('...');
ParameterTypeRequiredDescription
selectorstringYes
optionsPlaywrightCheckOptionsNo

Upstream docs


setChecked(selector, checked, options?)

Set the checked state of a checkbox.

Deprecated: Use locator.setChecked() instead.

1await runtime.page.setChecked('...', true);
ParameterTypeRequiredDescription
selectorstringYes
checkedbooleanYes
optionsPlaywrightSetCheckedOptionsNo

Upstream docs


selectOption(selector, values, options?)

Select one or more options in a <select> element.

Deprecated: Use locator.selectOption() instead.

1await runtime.page.selectOption('...', /* values */);
ParameterTypeRequiredDescription
selectorstringYes
valuesstring | SelectOption | (string | SelectOption)[]Yes
optionsPlaywrightSelectOptionOptionsNo

Returns string[]

Upstream docs


setInputFiles(selector, files, options?)

Set input files for a file input element.

Deprecated: Use locator.setInputFiles() instead.

1await runtime.page.setInputFiles('...', /* files */);
ParameterTypeRequiredDescription
selectorstringYes
filesstring | string[] | FilePayload | FilePayload[]Yes
optionsPlaywrightSetInputFilesOptionsNo

Upstream docs


dispatchEvent(selector, type, eventInit?, options?)

Dispatch a DOM event on an element.

Deprecated: Use locator.dispatchEvent() instead.

1await runtime.page.dispatchEvent('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
typestringYes
eventInitRecord&lt;string, unknown&gt;No
optionsPlaywrightDispatchEventOptionsNo

Upstream docs


dragAndDrop(source, target, options?)

Drag an element to another element.

1await runtime.page.dragAndDrop('...', '...');
ParameterTypeRequiredDescription
sourcestringYes
targetstringYes
optionsPlaywrightDragAndDropOptionsNo

Upstream docs


Queries

$(selector)

Query for a single element. Alias for page.querySelector().

Deprecated: Use locator() instead.

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

Returns RemotePlaywrightElementHandle \| null

Upstream docs


$$(selector)

Query for all matching elements. Alias for page.querySelectorAll().

Deprecated: Use locator() instead.

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

Returns RemotePlaywrightElementHandle[]

Upstream docs


querySelector(selector)

Query for a single element.

Deprecated: Use locator() instead.

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

Returns RemotePlaywrightElementHandle \| null

Upstream docs


querySelectorAll(selector)

Query for all matching elements.

Deprecated: Use locator() instead.

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

Returns RemotePlaywrightElementHandle[]

Upstream docs


locator(selector, options?)

Create a locator for the given selector.

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

Returns RemotePlaywrightLocator

Upstream docs


getByRole(role, options?)

Locate elements by their ARIA role, ARIA attributes, and accessible name.

1runtime.page.getByRole('...');
ParameterTypeRequiredDescription
rolestringYes
optionsPlaywrightGetByRoleOptionsNo

Returns RemotePlaywrightLocator

Upstream docs


getByText(text, options?)

Locate elements containing the given text.

1runtime.page.getByText(/* text */);
ParameterTypeRequiredDescription
textstring | RegExpYes
optionsPlaywrightGetByTextOptionsNo

Returns RemotePlaywrightLocator

Upstream docs


getByLabel(text, options?)

Locate form controls by the text of their associated labels.

1runtime.page.getByLabel(/* text */);
ParameterTypeRequiredDescription
textstring | RegExpYes
optionsPlaywrightGetByLabelOptionsNo

Returns RemotePlaywrightLocator

Upstream docs


getByPlaceholder(text, options?)

Locate input elements by their placeholder text.

1runtime.page.getByPlaceholder(/* text */);
ParameterTypeRequiredDescription
textstring | RegExpYes
optionsPlaywrightGetByPlaceholderOptionsNo

Returns RemotePlaywrightLocator

Upstream docs


getByAltText(text, options?)

Locate elements by their alt text.

1runtime.page.getByAltText(/* text */);
ParameterTypeRequiredDescription
textstring | RegExpYes
optionsPlaywrightGetByAltTextOptionsNo

Returns RemotePlaywrightLocator

Upstream docs


getByTitle(text, options?)

Locate elements by their title attribute.

1runtime.page.getByTitle(/* text */);
ParameterTypeRequiredDescription
textstring | RegExpYes
optionsPlaywrightGetByTitleOptionsNo

Returns RemotePlaywrightLocator

Upstream docs


getByTestId(testId)

Locate elements by their data-testid attribute.

1runtime.page.getByTestId(/* testId */);
ParameterTypeRequiredDescription
testIdstring | RegExpYes

Returns RemotePlaywrightLocator

Upstream docs


frameLocator(selector)

Create a frame locator for the given selector.

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

Returns RemotePlaywrightLocator

Upstream docs


Content

getAttribute(selector, name, options?)

Get an attribute value from an element.

Deprecated: Use locator.getAttribute() instead.

1await runtime.page.getAttribute('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
namestringYes
options{ strict?: boolean; timeout?: number }No

Returns string \| null

Upstream docs


textContent(selector, options?)

Get the text content of an element.

Deprecated: Use locator.textContent() instead.

1await runtime.page.textContent('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns string \| null

Upstream docs


innerText(selector, options?)

Get the inner text of an element.

Deprecated: Use locator.innerText() instead.

1await runtime.page.innerText('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns string

Upstream docs


innerHTML(selector, options?)

Get the inner HTML of an element.

Deprecated: Use locator.innerHTML() instead.

1await runtime.page.innerHTML('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns string

Upstream docs


inputValue(selector, options?)

Get the input value of an element.

Deprecated: Use locator.inputValue() instead.

1await runtime.page.inputValue('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns string

Upstream docs


State Checks

isVisible(selector, options?)

Check if an element is visible.

Deprecated: Use locator.isVisible() instead.

1await runtime.page.isVisible('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns boolean

Upstream docs


isHidden(selector, options?)

Check if an element is hidden.

Deprecated: Use locator.isHidden() instead.

1await runtime.page.isHidden('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns boolean

Upstream docs


isEnabled(selector, options?)

Check if an element is enabled.

Deprecated: Use locator.isEnabled() instead.

1await runtime.page.isEnabled('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns boolean

Upstream docs


isDisabled(selector, options?)

Check if an element is disabled.

Deprecated: Use locator.isDisabled() instead.

1await runtime.page.isDisabled('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns boolean

Upstream docs


isEditable(selector, options?)

Check if an element is editable.

Deprecated: Use locator.isEditable() instead.

1await runtime.page.isEditable('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns boolean

Upstream docs


isChecked(selector, options?)

Check if a checkbox is checked.

Deprecated: Use locator.isChecked() instead.

1await runtime.page.isChecked('...');
ParameterTypeRequiredDescription
selectorstringYes
options{ strict?: boolean; timeout?: number }No

Returns boolean

Upstream docs


Waiting

waitForSelector(selector, options?)

Wait for a selector to appear in the DOM.

Deprecated: Use locator-based methods or web assertions instead.

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

Returns RemotePlaywrightElementHandle \| null

Upstream docs


waitForTimeout(timeout)

Wait for the specified timeout.

Discouraged: Use time-based assertions or auto-waiting instead.

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

Upstream docs


waitForFunction(pageFunction, arg?, options?)

Wait for a function to return a truthy value.

Note: Returns a serialized handle reference. Full JSHandle support not yet available.

1await runtime.page.waitForFunction('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
argunknownNo
optionsPlaywrightWaitForFunctionOptionsNo

Returns unknown

Upstream docs


waitForEvent(event, optionsOrPredicate?)

Wait for a specific event to fire.

1await runtime.page.waitForEvent(/* K */);
ParameterTypeRequiredDescription
eventKYes
optionsOrPredicate{ predicate?: (event: PageEvents[K]) =&gt; boolean | Promise&lt;boolean&gt;; timeout?: number } | ((event: PageEvents[K]) =&gt; boolean | Promise&lt;boolean&gt;)No

Returns PageEvents[K]

Upstream docs


waitForRequest(urlOrPredicate, options?)

Wait for a specific request.

1await runtime.page.waitForRequest(/* urlOrPredicate */);
ParameterTypeRequiredDescription
urlOrPredicatestring | RegExp | ((request: PlaywrightRequest) =&gt; boolean | Promise&lt;boolean&gt;)Yes
options{ timeout?: number }No

Returns PlaywrightRequest

Upstream docs


waitForResponse(urlOrPredicate, options?)

Wait for a specific response.

1await runtime.page.waitForResponse(/* urlOrPredicate */);
ParameterTypeRequiredDescription
urlOrPredicatestring | RegExp | ((response: PlaywrightResponse) =&gt; boolean | Promise&lt;boolean&gt;)Yes
options{ timeout?: number }No

Returns PlaywrightResponse

Upstream docs


Screenshots & PDF

screenshot(options?)

Take a screenshot of the page.

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

Returns Buffer

Upstream docs


pdf(options?)

Generate a PDF of the page (Chromium only).

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

Returns Buffer

Upstream docs


Evaluation

evaluate(pageFunction, arg?)

Evaluate JavaScript in the page context.

1await runtime.page.evaluate('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
argunknownNo

Returns R

Upstream docs


evaluateHandle(pageFunction, arg?)

Evaluate JavaScript and return a handle to the result.

1await runtime.page.evaluateHandle('...');
ParameterTypeRequiredDescription
pageFunctionFunction | stringYes
argunknownNo

Returns RemotePlaywrightJSHandle

Upstream docs


$eval(selector, pageFunction, arg?)

Find an element matching the selector and evaluate a function on it.

Deprecated: This method does not wait for the element to pass actionability checks. Use locator.evaluate() instead.

1await runtime.page.$eval('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
pageFunctionFunction | stringYes
argunknownNo

Returns T

Upstream docs


$$eval(selector, pageFunction, arg?)

Find all elements matching the selector and evaluate a function on the array of elements.

Deprecated: This method does not wait for elements to pass actionability checks. Use locator.evaluateAll() instead.

1await runtime.page.$$eval('...', '...');
ParameterTypeRequiredDescription
selectorstringYes
pageFunctionFunction | stringYes
argunknownNo

Returns T

Upstream docs


Lifecycle

close(options?)

Close the page.

1await runtime.page.close();
ParameterTypeRequiredDescription
options{ runBeforeUnload?: boolean }No

Upstream docs


bringToFront()

Bring page to front (activate tab).

1await runtime.page.bringToFront();

Upstream docs


Other

emulateMedia(options?)

Emulate media type, color scheme, etc.

1await runtime.page.emulateMedia();
ParameterTypeRequiredDescription
optionsPlaywrightEmulateMediaOptionsNo

Upstream docs


mainFrame()

Get the main frame.

1await runtime.page.mainFrame();

Returns RemotePlaywrightFrame

Upstream docs


frames()

Get all frames attached to the page.

1await runtime.page.frames();

Returns RemotePlaywrightFrame[]

Upstream docs


frame(frameSelector)

Get a frame by name or URL.

1await runtime.page.frame(/* frameSelector */);
ParameterTypeRequiredDescription
frameSelectorstring | { name?: string; url?: string | RegExp | ((url: URL) =&gt; boolean) }Yes

Returns RemotePlaywrightFrame \| null

Upstream docs


route(url, handler, options?)

Route requests matching the URL pattern.

1await runtime.page.route(/* url */, /* PlaywrightRouteHandler */);
ParameterTypeRequiredDescription
urlstring | RegExp | ((url: URL) =&gt; boolean)Yes
handlerPlaywrightRouteHandlerYes
options{ times?: number }No

Upstream docs


unroute(url, handler?)

Remove a route.

1await runtime.page.unroute(/* url */);
ParameterTypeRequiredDescription
urlstring | RegExp | ((url: URL) =&gt; boolean)Yes
handlerPlaywrightRouteHandlerNo

Upstream docs


unrouteAll(options?)

Remove all routes.

1await runtime.page.unrouteAll();
ParameterTypeRequiredDescription
options{ behavior?: "wait" | "ignoreErrors" | "default" }No

Upstream docs


setExtraHTTPHeaders(headers)

Set extra HTTP headers for all requests.

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

Upstream docs


context()

Get the browser context that the page belongs to.

1runtime.page.context();

Returns unknown

Upstream docs


setDefaultTimeout(timeout)

Set the default timeout for all methods.

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

Upstream docs


setDefaultNavigationTimeout(timeout)

Set the default navigation timeout.

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

Upstream docs


addInitScript(script, arg?)

Add a script to evaluate before page scripts run.

1await runtime.page.addInitScript(/* script */);
ParameterTypeRequiredDescription
scriptFunction | string | { path?: string; content?: string }Yes
argunknownNo

Upstream docs


addScriptTag(options)

Add a <script> tag to the page.

1await runtime.page.addScriptTag(/* PlaywrightAddScriptTagOptions */);
ParameterTypeRequiredDescription
optionsPlaywrightAddScriptTagOptionsYes

Returns RemotePlaywrightElementHandle

Upstream docs


addStyleTag(options)

Add a <style> tag to the page.

1await runtime.page.addStyleTag(/* PlaywrightAddStyleTagOptions */);
ParameterTypeRequiredDescription
optionsPlaywrightAddStyleTagOptionsYes

Returns RemotePlaywrightElementHandle

Upstream docs


exposeBinding(name, callback, options?)

Expose a binding to the page (with source info).

1await runtime.page.exposeBinding('...', '...');
ParameterTypeRequiredDescription
namestringYes
callbackFunctionYes
options{ handle?: boolean }No

Upstream docs


pause()

Pause script execution (for debugging).

1await runtime.page.pause();

Upstream docs


video()

Get the video object if recording is enabled.

1runtime.page.video();

Returns { path: () =&gt; Promise&lt;string \| null&gt;; saveAs: (path: string) =&gt; Promise&lt;void&gt;; delete: () =&gt; Promise&lt;void&gt; } \| null

Upstream docs


opener()

Get the page that opened this page (via window.open).

1await runtime.page.opener();

Returns RemotePlaywrightPage \| null

Upstream docs


workers()

Get all web workers in the page.

1runtime.page.workers();

Returns unknown[]

Upstream docs


addLocatorHandler(locator, handler, options?)

Registers a handler that will be called when the specified locator becomes visible on the page.

Useful for handling overlays and popups that may appear during automation.

1await runtime.page.addLocatorHandler(/* RemotePlaywrightLocator */, /* (locator: RemotePlaywrightLocator) => Promise<void> */);
ParameterTypeRequiredDescription
locatorRemotePlaywrightLocatorYes
handler(locator: RemotePlaywrightLocator) =&gt; Promise&lt;void&gt;Yes
optionsPlaywrightAddLocatorHandlerOptionsNo

Upstream docs


removeLocatorHandler(locator)

Removes a previously added locator handler.

1await runtime.page.removeLocatorHandler(/* RemotePlaywrightLocator */);
ParameterTypeRequiredDescription
locatorRemotePlaywrightLocatorYes

Upstream docs


consoleMessages()

Returns all console messages captured during the page lifecycle.

Note: This is a custom method that returns accumulated console messages.

1await runtime.page.consoleMessages();

Returns PlaywrightConsoleMessage[]

Upstream docs


pageErrors()

Returns all page errors (uncaught exceptions) captured during the page lifecycle.

Note: This is a custom method that returns accumulated page errors.

1await runtime.page.pageErrors();

Returns Error[]

Upstream docs


requestGC()

Request garbage collection in the page context.

Note: This method is only available in Chromium-based browsers.

1await runtime.page.requestGC();

Upstream docs


requests()

Returns all requests made by the page since the last navigation.

Note: This is a custom method that returns accumulated requests.

1await runtime.page.requests();

Returns PlaywrightRequest[]

Upstream docs


routeFromHAR(har, options?)

Serves network requests from a HAR (HTTP Archive) file.

Useful for replaying recorded network traffic during tests.

1await runtime.page.routeFromHAR('...');
ParameterTypeRequiredDescription
harstringYes
optionsPlaywrightRouteFromHAROptionsNo

Upstream docs


routeWebSocket(url, handler)

Route WebSocket connections matching the URL pattern.

Allows intercepting and modifying WebSocket traffic.

1await runtime.page.routeWebSocket(/* url */, /* handler */);
ParameterTypeRequiredDescription
urlstring | RegExp | ((url: URL) =&gt; boolean)Yes
handler(ws: PlaywrightWebSocketRoute) =&gt; void | Promise&lt;void&gt;Yes

Upstream docs


Mouse

mouse.click(x, y, options?)

Shortcut for mouse.move(), mouse.down(), mouse.up().

Simulates a mouse click at the specified coordinates.

1```ts
2await page.mouse.click(100, 50);
3await page.mouse.click(200, 100, { button: 'right', delay: 100 });
| Parameter | Type | Required | Description |
|---|---|---|---|
| `x` | `number` | Yes | X coordinate relative to the main frame viewport in CSS pixels. |
| `y` | `number` | Yes | Y coordinate relative to the main frame viewport in CSS pixels. |
| `options` | `PlaywrightMouseClickOptions` | No | Click options. |
[Upstream docs](https://playwright.dev/docs/api/class-mouse#mouse-click)
---
### mouse.dblclick(x, y, options?)
Shortcut for mouse.move(), mouse.down(), mouse.up(), mouse.down(), mouse.up().
<Note>
Simulates a double mouse click at the specified coordinates.
</Note>
```ts
```ts
await page.mouse.dblclick(100, 50);
await page.mouse.dblclick(200, 100, { delay: 50 });
| Parameter | Type | Required | Description |
|---|---|---|---|
| `x` | `number` | Yes | X coordinate relative to the main frame viewport in CSS pixels. |
| `y` | `number` | Yes | Y coordinate relative to the main frame viewport in CSS pixels. |
| `options` | `PlaywrightMouseDblclickOptions` | No | Double-click options. |
[Upstream docs](https://playwright.dev/docs/api/class-mouse#mouse-dblclick)
---
### mouse.down(options?)
Dispatches a mousedown event.
```ts
await runtime.page.mouse.down();
ParameterTypeRequiredDescription
optionsPlaywrightMouseDownUpOptionsNoMouse down options.

Upstream docs


mouse.up(options?)

Dispatches a mouseup event.

1await runtime.page.mouse.up();
ParameterTypeRequiredDescription
optionsPlaywrightMouseDownUpOptionsNoMouse up options.

Upstream docs


mouse.move(x, y, options?)

Dispatches a mousemove event.

The steps option controls the number of intermediate mousemove events to generate.

1await runtime.page.mouse.move(0, 0);
ParameterTypeRequiredDescription
xnumberYesX coordinate relative to the main frame viewport in CSS pixels.
ynumberYesY coordinate relative to the main frame viewport in CSS pixels.
optionsPlaywrightMouseMoveOptionsNoMouse move options.

Upstream docs


mouse.wheel(deltaX, deltaY)

Dispatches a wheel event.

This method is usually used to manually scroll the page. Wheel events may cause scrolling if they are not handled, and this method does not wait for the scrolling to finish before returning.

1```ts
2// Scroll down by 100 pixels
3await page.mouse.wheel(0, 100);
| Parameter | Type | Required | Description |
|---|---|---|---|
| `deltaX` | `number` | Yes | Pixels to scroll horizontally. |
| `deltaY` | `number` | Yes | Pixels to scroll vertically. |
[Upstream docs](https://playwright.dev/docs/api/class-mouse#mouse-wheel)
---
## Keyboard
### keyboard.down(key)
Dispatches a keydown event.
<Note>
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.
</Note>
```ts
await runtime.page.keyboard.down('...');
ParameterTypeRequiredDescription
keystringYesName of the key to press or a character to generate, such as ArrowLeft or a.

Upstream docs


keyboard.up(key)

Dispatches a keyup event.

1await runtime.page.keyboard.up('...');
ParameterTypeRequiredDescription
keystringYesName of the key to release or a character.

Upstream docs


keyboard.press(key, options?)

Shortcut for keyboard.down() and keyboard.up().

Dispatches a keydown, keypress/input, and keyup event for the specified key.

If key is a single character and no modifier keys besides Shift are being held down, a keypress/input event will also be generated.

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

Shortcut such as “ControlOrMeta+A” are supported. “ControlOrMeta” resolves to “Control” on Windows/Linux and to “Meta” on macOS.

1```ts
2await page.keyboard.press('Enter');
3await page.keyboard.press('Shift+A');
4await page.keyboard.press('ControlOrMeta+A');
| Parameter | Type | Required | Description |
|---|---|---|---|
| `key` | `string` | Yes | Key to press. Can be a character or a special key name (e.g., `ArrowLeft`, `Shift+A`, `ControlOrMeta+A`). |
| `options` | `PlaywrightKeyboardPressOptions` | No | Options for the key press event. |
[Upstream docs](https://playwright.dev/docs/api/class-keyboard#keyboard-press)
---
### keyboard.type(text, options?)
Sends a keydown, keypress/input, and keyup event for each character in the text.
<Note>
Use this method when you need to simulate typing character by character,
for example, if the page has custom keyboard event listeners.
Modifier keys DO NOT affect keyboard.type. Holding down Shift will not type the text in upper case.
For characters not present on a standard US keyboard layout, only an input event will be dispatched.
For simple text input, locator.fill() is generally preferred.
</Note>
```ts
```ts
await page.keyboard.type('Hello'); // Types instantly
await page.keyboard.type('World', { delay: 100 }); // Types slower, like a user
| Parameter | Type | Required | Description |
|---|---|---|---|
| `text` | `string` | Yes | Text to type. |
| `options` | `PlaywrightKeyboardTypeOptions` | No | Options for typing. |
[Upstream docs](https://playwright.dev/docs/api/class-keyboard#keyboard-type)
---
### keyboard.insertText(text)
Dispatches only an input event, does not emit keydown, keyup, or keypress events.
<Note>
This method is useful for directly inserting text without simulating physical key presses.
Modifier keys DO NOT affect keyboard.insertText. Holding down Shift will not type the text in upper case.
</Note>
```ts
```ts
await page.keyboard.insertText('Hello');
| Parameter | Type | Required | Description |
|---|---|---|---|
| `text` | `string` | Yes | Text to insert. |
[Upstream docs](https://playwright.dev/docs/api/class-keyboard#keyboard-insert-text)
---
## Touchscreen
### touchscreen.tap(x, y)
Dispatches a touchstart and touchend event with a single touch at the position (x, y).
<Note>
This method simulates a tap gesture on a touchscreen device.
Note: The page must be initialized with hasTouch option of the browser context set to true.
</Note>
```ts
```ts
await page.touchscreen.tap(100, 200);
| Parameter | Type | Required | Description |
|---|---|---|---|
| `x` | `number` | Yes | X coordinate relative to the main frame viewport in CSS pixels. |
| `y` | `number` | Yes | Y coordinate relative to the main frame viewport in CSS pixels. |
[Upstream docs](https://playwright.dev/docs/api/class-touchscreen#touchscreen-tap)
---