Back to Puppeteer

Locator.setEnsureElementIsInTheViewport() method

website/versioned_docs/version-24.40.0/api/puppeteer.locator.setensureelementisintheviewport.md

19.2.2815 B
Original Source

Locator.setEnsureElementIsInTheViewport() method

Creates a new locator instance by cloning the current locator and specifying whether the locator should scroll the element into viewport if it is not in the viewport already.

Signature

typescript
class Locator {
  setEnsureElementIsInTheViewport<ElementType extends Element>(
    this: Locator<ElementType>,
    value: boolean,
  ): Locator<ElementType>;
}

Parameters

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

this

</td><td>

Locator<ElementType>

</td><td> </td></tr> <tr><td>

value

</td><td>

boolean

</td><td> </td></tr> </tbody></table>

Returns:

Locator<ElementType>

Default value:

true