Last updated 5 months ago

Example Handle represents a remote element in the DOM of the browser. It implements useful methods for querying and interacting with this DOM element.

All methids on this class are asynchronous and must be used with await to wait for the result to fulfill from the browser.


Clears focus from this element so that it will no longer receive keyboard inputs.


Schedules a command to clear the value of this element. This command has no effect if the underlying DOM element is neither a text INPUT, SELECT, or a TEXTAREA element.

elementHandle.click([, options])

Sends a click event to the element attached to this handle. If the element is currently outside the viewport it will first scroll to that element.


  • locator

  • returns: <Promise<[ElementHandle]|null>>

Locates an element using the supplied <Locator>, returning an <[ElementHandle]>


Locates all elements using the supplied <Locator>, returning an array of <[ElementHandle]>'s


Sends focus to this element so that it receives keyboard inputs.


Fetches the value of an attribute on this element


Fetches the remote elements id attribute.


Checks whether the remote element is displayed in the DOM and is visible to the user without being hidden by CSS or occluded by another element.


Checks whether the remote element is enabled. Typically this means it does not have a disabled property or attribute applied.


Checks whether the remote element is selectable. An element is selectable if it is an <option> or input[type="checkbox"] or radio button.


If the remote element is selectable (such as an <option> or input[type="checkbox"]) this methos will indicate whether it is selected.


  • returns: <Promise<{"y":"number","x":"number"}>>

Fetches the remote elements physical location as x and y.


Sends a series of key modifiers to the element.


  • returns: <Promise<{"width":"number","height":"number"}>>

Fetches the remote elements physical dimensions as width and height.


Fetches the remote elements tagName property.

elementHandle.takeScreenshot([, options])

  • options <[ScreenshotOptions]> (Optional)

  • returns: <Promise>

Takes a screenshot of this element and saves it to the results folder with a random name.


Retrieves the text content of this element excluding leading and trailing whitespace.


Sends a series of key presses to the element to simulate a user typing on the keyboard. Use this to fill in input fields.

[ScreenshotOptions]: Interfaces.md#screenshotoptions