Skip to main content
Frame actions methods for the Playwright driver.

click

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.
Upstream docs
selector
string
required
options
PlaywrightClickOptions
await frame.click('...');

dblclick

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.
Upstream docs
selector
string
required
options
PlaywrightClickOptions
await frame.dblclick('...');

fill

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.
Upstream docs
selector
string
required
value
string
required
options
PlaywrightFillOptions
await frame.fill('...', '...');

type

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.
Upstream docs
selector
string
required
text
string
required
options
PlaywrightTypeOptions
await frame.type('...', '...');

press

Presses a key.
Focuses the element matching selector, and then uses keyboard.press. Discouraged: use locator-based locator.press() instead.
Upstream docs
selector
string
required
key
string
required
options
PlaywrightPressOptions
await frame.press('...', '...');

hover

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.
Upstream docs
selector
string
required
options
PlaywrightHoverOptions
await frame.hover('...');

focus

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.
Upstream docs
selector
string
required
options
PlaywrightFocusOptions
await frame.focus('...');

tap

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.
Upstream docs
selector
string
required
options
{ force?: boolean; modifiers?: ("Alt" | "Control" | "Meta" | "Shift")[]; noWaitAfter?: boolean; position?: { x: number; y: number }; strict?: boolean; timeout?: number; trial?: boolean }
await frame.tap('...');

check

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.
Upstream docs
selector
string
required
options
PlaywrightCheckOptions
await frame.check('...');

uncheck

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.
Upstream docs
selector
string
required
options
PlaywrightCheckOptions
await frame.uncheck('...');

setChecked

Checks or unchecks a checkbox or radio element.
This method checks or unchecks an element matching selector. Discouraged: use locator-based locator.setChecked() instead.
Upstream docs
selector
string
required
checked
boolean
required
options
PlaywrightCheckOptions
await frame.setChecked('...', true);

selectOption

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.
Upstream docs
selector
string
required
values
string | string[] | { value?: string; label?: string; index?: number } | { value?: string; label?: string; index?: number }[] | null
required
options
PlaywrightSelectOptionOptions
result
string[]
Return value
await frame.selectOption('...', /* string | string[] | { value?: string; label?: string; index?: number } | { value?: string; label?: string; index?: number }[] | null */);

setInputFiles

Sets the file input element to the given files.
Empty array clears the selected files. Discouraged: use locator-based locator.setInputFiles() instead.
Upstream docs
selector
string
required
files
string | string[] | { name: string; mimeType: string; buffer: Buffer } | { name: string; mimeType: string; buffer: Buffer }[]
required
options
{ noWaitAfter?: boolean; strict?: boolean; timeout?: number }
await frame.setInputFiles('...', /* string | string[] | { name: string; mimeType: string; buffer: Buffer } | { name: string; mimeType: string; buffer: Buffer }[] */);

dragAndDrop

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.
Upstream docs
source
string
required
target
string
required
options
{ force?: boolean; noWaitAfter?: boolean; sourcePosition?: { x: number; y: number }; strict?: boolean; targetPosition?: { x: number; y: number }; timeout?: number; trial?: boolean }
await frame.dragAndDrop('...', '...');

dispatchEvent

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.
Upstream docs
selector
string
required
type
string
required
eventInit
unknown
options
{ strict?: boolean; timeout?: number }
await frame.dispatchEvent('...', '...');