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.
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.
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.
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.
press
Presses a key.Focuses the element matching selector, and then uses keyboard.press. Discouraged: use locator-based locator.press() instead.
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.
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.
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.
options
{ force?: boolean; modifiers?: ("Alt" | "Control" | "Meta" | "Shift")[]; noWaitAfter?: boolean; position?: { x: number; y: number }; strict?: boolean; timeout?: number; trial?: boolean }
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.
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.
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.
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.
values
string | string[] | { value?: string; label?: string; index?: number } | { value?: string; label?: string; index?: number }[] | null
required
Return value
setInputFiles
Sets the file input element to the given files.Empty array clears the selected files. Discouraged: use locator-based locator.setInputFiles() instead.
files
string | string[] | { name: string; mimeType: string; buffer: Buffer } | { name: string; mimeType: string; buffer: Buffer }[]
required
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.
options
{ force?: boolean; noWaitAfter?: boolean; sourcePosition?: { x: number; y: number }; strict?: boolean; targetPosition?: { x: number; y: number }; timeout?: number; trial?: boolean }
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.

