puppeteer/docs/api/puppeteer.locator.md
jrandolf ede43ca2d3
chore: use RxJS for locator implementation (#10607)
Using RxJS greatly simplifies the control flow for locators and comes with automatic cleanup on failure. It greatly simplifies the `signal` logic and the retry logic.
2023-07-25 12:43:07 +02:00

6.1 KiB

sidebar_label
Locator

Locator class

Locators describe a strategy of locating elements and performing an action on them. If the action fails because the element is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically.

Signature:

export declare abstract class Locator<T> extends EventEmitter

Extends: EventEmitter

Properties

Property Modifiers Type Description
_ optional T Used for nominally typing Locator.

Methods

Method Modifiers Description
click(this, options)
fill(this, value, options) Fills out the input identified by the locator using the provided value. The type of the input is determined at runtime and the appropriate fill-out method is chosen based on the type. contenteditable, selector, inputs are supported.
hover(this, options)
off(eventName, handler)
on(eventName, handler)
once(eventName, handler)
race(locators) static Creates a race between multiple locators but ensures that only a single one acts.
scroll(this, options)
setEnsureElementIsInTheViewport(this, value)
setTimeout(timeout)
setVisibility(this, visibility)
setWaitForEnabled(this, value)
setWaitForStableBoundingBox(this, value)