Back to Puppeteer

Locator.fill() method

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

19.2.2952 B
Original Source

Locator.fill() method

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, select, textarea and input elements are supported.

Signature

typescript
class Locator {
  fill<ElementType extends Element>(
    this: Locator<ElementType>,
    value: string,
    options?: Readonly<LocatorFillOptions>,
  ): Promise<void>;
}

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>

string

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

options

</td><td>

Readonly<LocatorFillOptions>

</td><td>

(Optional)

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

Returns:

Promise<void>