*** title: Playwright Frame description: Complete Frame method reference for the Playwright driver. ----------------------------------------------------------------------- All `Frame` methods available when using the **Playwright** driver. Access via `frame` 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 ``` ```json { "runtime": "my-browser", "steps": [ { "call": "frame.goto", "args": ["https://example.com"] } ] } ``` 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. ## Navigation ### goto(url, options?) Returns the main resource response. Navigates the frame to the given URL. In case of multiple redirects, the navigation will resolve with the first non-redirect response. The method will throw an error if navigation fails. The method will not throw an error when any valid HTTP status code is returned by the remote server. ```ts await frame.goto('...'); ``` | Parameter | Type | Required | Description | | --------- | ----------------------- | -------- | ----------- | | `url` | `string` | Yes | — | | `options` | `PlaywrightGotoOptions` | No | — | **Returns** `SerializedHandle \| null` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-goto) *** ### waitForURL(url, options?) Waits for the frame to navigate to the given URL. This method can be used after an action that causes navigation. A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation. ```ts await frame.waitForURL(/* url */); ``` | Parameter | Type | Required | Description | | --------- | ------------------------------------------------ | -------- | ----------- | | `url` | `string \| RegExp \| ((url: URL) => boolean)` | Yes | — | | `options` | `PlaywrightWaitForURLOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-wait-for-url) *** ### waitForLoadState(state?, options?) Waits for the required load state to be reached. This method returns when the page reaches a required load state, 'load' by default. The navigation must have been committed when this method is called. ```ts await frame.waitForLoadState(); ``` | Parameter | Type | Required | Description | | --------- | ----------------------------------------------- | -------- | ------------------------------------ | | `state` | `"load" \| "domcontentloaded" \| "networkidle"` | No | State to wait for, defaults to load. | | `options` | `{ timeout?: number }` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-wait-for-load-state) *** ## Page Info ### url() Returns frame's URL. ```ts await frame.url(); ``` **Returns** `string` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-url) *** ### title() Returns the page title. ```ts await frame.title(); ``` **Returns** `string` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-title) *** ### content() Gets the full HTML contents of the frame, including the doctype. ```ts await frame.content(); ``` **Returns** `string` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-content) *** ### setContent(html, options?) Sets the content of the frame. This method takes the HTML to set as the frame's content. The default waitUntil is 'load'. ```ts await frame.setContent('...'); ``` | Parameter | Type | Required | Description | | --------- | --------------------------------------------------------------------------------------------- | -------- | ----------- | | `html` | `string` | Yes | — | | `options` | `{ timeout?: number; waitUntil?: "load" \| "domcontentloaded" \| "networkidle" \| "commit" }` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-set-content) *** ## Actions ### click(selector, options?) Clicks an element matching selector. This method waits for actionability checks, scrolls element into view, and then clicks the center of the element. Discouraged: use locator-based locator.click() instead. ```ts await frame.click('...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `PlaywrightClickOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-click) *** ### dblclick(selector, options?) Double-clicks an element matching selector. This method waits for actionability checks, scrolls element into view, and then double-clicks the center of the element. Discouraged: use locator-based locator.dblclick() instead. ```ts await frame.dblclick('...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `PlaywrightClickOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-dblclick) *** ### fill(selector, value, options?) Fills a form field with text. This method waits for an element matching selector, waits for actionability checks, focuses the element, fills it and triggers an input event. Discouraged: use locator-based locator.fill() instead. ```ts await frame.fill('...', '...'); ``` | Parameter | Type | Required | Description | | ---------- | ----------------------- | -------- | ----------- | | `selector` | `string` | Yes | — | | `value` | `string` | Yes | — | | `options` | `PlaywrightFillOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-fill) *** ### type(selector, text, options?) Types into an element matching selector. Sends a keydown, keypress/input, and keyup event for each character in the text. Discouraged: In most cases, you should use locator.fill() instead. ```ts await frame.type('...', '...'); ``` | Parameter | Type | Required | Description | | ---------- | ----------------------- | -------- | ----------- | | `selector` | `string` | Yes | — | | `text` | `string` | Yes | — | | `options` | `PlaywrightTypeOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-type) *** ### press(selector, key, options?) Presses a key. Focuses the element matching selector, and then uses keyboard.press. Discouraged: use locator-based locator.press() instead. ```ts await frame.press('...', '...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `key` | `string` | Yes | — | | `options` | `PlaywrightPressOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-press) *** ### hover(selector, options?) Hovers over an element matching selector. This method waits for actionability checks, scrolls element into view, and then hovers over the center of the element. Discouraged: use locator-based locator.hover() instead. ```ts await frame.hover('...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `PlaywrightHoverOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-hover) *** ### focus(selector, options?) Fetches the element matching selector and focuses it. If there is no element matching selector, the method waits until a matching element appears in the DOM. Discouraged: use locator-based locator.focus() instead. ```ts await frame.focus('...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `PlaywrightFocusOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-focus) *** ### tap(selector, options?) Taps an element matching selector. This method waits for actionability checks, scrolls element into view, and then taps the center of the element. Discouraged: use locator-based locator.tap() instead. ```ts await frame.tap('...'); ``` | Parameter | Type | Required | Description | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `{ force?: boolean; modifiers?: ("Alt" \| "Control" \| "Meta" \| "Shift")[]; noWaitAfter?: boolean; position?: { x: number; y: number }; strict?: boolean; timeout?: number; trial?: boolean }` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-tap) *** ### check(selector, options?) Checks a checkbox or radio element. This method checks an element matching selector by performing the following steps: scrolls element into view, and then uses click to check the element. Discouraged: use locator-based locator.check() instead. ```ts await frame.check('...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `PlaywrightCheckOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-check) *** ### uncheck(selector, options?) Unchecks a checkbox element. This method unchecks an element matching selector by scrolling element into view and using click to uncheck the element. Discouraged: use locator-based locator.uncheck() instead. ```ts await frame.uncheck('...'); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `PlaywrightCheckOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-uncheck) *** ### setChecked(selector, checked, options?) Checks or unchecks a checkbox or radio element. This method checks or unchecks an element matching selector. Discouraged: use locator-based locator.setChecked() instead. ```ts await frame.setChecked('...', true); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `checked` | `boolean` | Yes | — | | `options` | `PlaywrightCheckOptions` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-set-checked) *** ### selectOption(selector, values, options?) Selects option(s) in the select element. Returns array of selected option values. Shortcuts such as "blue" match both value and label. Objects such as \{ label: "blue" } match by label only. Discouraged: use locator-based locator.selectOption() instead. ```ts await frame.selectOption('...', /* values */); ``` | Parameter | Type | Required | Description | | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------- | | `selector` | `string` | Yes | — | | `values` | `string \| string[] \| { value?: string; label?: string; index?: number } \| { value?: string; label?: string; index?: number }[] \| null` | Yes | — | | `options` | `PlaywrightSelectOptionOptions` | No | — | **Returns** `string[]` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-select-option) *** ### setInputFiles(selector, files, options?) Sets the file input element to the given files. Empty array clears the selected files. Discouraged: use locator-based locator.setInputFiles() instead. ```ts await frame.setInputFiles('...', /* files */); ``` | Parameter | Type | Required | Description | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- | | `selector` | `string` | Yes | — | | `files` | `string \| string[] \| { name: string; mimeType: string; buffer: Buffer } \| { name: string; mimeType: string; buffer: Buffer }[]` | Yes | — | | `options` | `{ noWaitAfter?: boolean; strict?: boolean; timeout?: number }` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-set-input-files) *** ### dragAndDrop(source, target, options?) Drags source element to target element. This method drags the source element to the target element. It will first move to the source element, perform a mousedown, then move to the target element and perform a mouseup. ```ts await frame.dragAndDrop('...', '...'); ``` | Parameter | Type | Required | Description | | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- | | `source` | `string` | Yes | — | | `target` | `string` | Yes | — | | `options` | `{ force?: boolean; noWaitAfter?: boolean; sourcePosition?: { x: number; y: number }; strict?: boolean; targetPosition?: { x: number; y: number }; timeout?: number; trial?: boolean }` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-drag-and-drop) *** ### dispatchEvent(selector, type, eventInit?, options?) Dispatches an event on the element. This method dispatches a DOM event on the element matching selector. Events are composed, cancelable, and bubble by default. Discouraged: use locator-based locator.dispatchEvent() instead. ```ts await frame.dispatchEvent('...', '...'); ``` | Parameter | Type | Required | Description | | ----------- | ---------------------------------------- | -------- | ----------- | | `selector` | `string` | Yes | — | | `type` | `string` | Yes | — | | `eventInit` | `unknown` | No | — | | `options` | `{ strict?: boolean; timeout?: number }` | No | — | [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-dispatch-event) *** ## Queries ### page() Returns the page containing this frame. Returns the cached page reference passed at construction time. ```ts frame.page(); ``` **Returns** `RemotePlaywrightPage` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-page) *** ### locator(selector, options?) The method returns a Locator for the given selector. The locator is a building block for accessing and interacting with elements on the page. Locators are strict by default - they will throw if more than one element matches the selector. ```ts frame.locator('...'); ``` | Parameter | Type | Required | Description | | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- | | `selector` | `string` | Yes | — | | `options` | `{ has?: RemotePlaywrightLocator; hasNot?: RemotePlaywrightLocator; hasText?: string \| RegExp; hasNotText?: string \| RegExp }` | No | — | **Returns** `RemotePlaywrightLocator` [Upstream docs](https://playwright.dev/docs/api/class-frame#frame-locator) *** ### frameLocator(selector) Returns a FrameLocator for the given selector. Use this when the \