puppeteer/website/versioned_docs/version-20.7.2/api/puppeteer.locator.md
release-please[bot] f93b94533d
chore: release main (#10386)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2023-06-16 07:45:43 +00:00

5.7 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 extends EventEmitter

Extends: EventEmitter

Methods

Method Modifiers Description
click(clickOptions)
fill(value, fillOptions) 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(hoverOptions)
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(scrollOptions)
setEnsureElementIsInTheViewport(value)
setTimeout(timeout)
setVisibility(visibility)
setWaitForEnabled(value)
setWaitForStableBoundingBox(value)