Table of Contents

Class CdpElementHandle

Namespace
PuppeteerSharp.Cdp
Assembly
PuppeteerSharp.dll

Inherits from IJSHandle. It represents an in-page DOM element. ElementHandles can be created by QuerySelectorAsync(string) or QuerySelectorAllAsync(string).

public class CdpElementHandle : ElementHandle, IElementHandle, IJSHandle, IAsyncDisposable
Inheritance
CdpElementHandle
Implements
Extension Methods

Properties

Page

Element's page.

protected override Page Page { get; }

Property Value

Page

RemoteObject

CDP Remote object.

public RemoteObject RemoteObject { get; }

Property Value

RemoteObject

Methods

AutofillAsync(AutofillData)

If the element is a form input, you can use AutofillAsync(AutofillData) to test if the form is compatible with the browser's autofill implementation. Throws an error if the form cannot be autofilled.

public override Task AutofillAsync(AutofillData data)

Parameters

data AutofillData

The autofill data.

Returns

Task

A task that resolves when the autofill is complete.

Remarks

Currently, Puppeteer supports auto-filling credit card information only and in Chrome in the new headless and headful modes only.

BackendNodeIdAsync()

When connected using Chrome DevTools Protocol, it returns a DOM.BackendNodeId for the element.

public override Task<int> BackendNodeIdAsync()

Returns

Task<int>

A task that resolves to the backend node ID.

ContentFrameAsync()

Resolves the frame associated with the element..

public override Task<IFrame> ContentFrameAsync()

Returns

Task<IFrame>

Task which resolves to the frame associated with the element.

ScrollIntoViewAsync()

Scrolls the element into view using either the automation protocol client or by calling element.scrollIntoView.

public override Task ScrollIntoViewAsync()

Returns

Task

A Task that resolves when the message was confirmed by the browser.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

UploadFileAsync(bool, params string[])

Uploads files.

public override Task UploadFileAsync(bool resolveFilePaths, params string[] filePaths)

Parameters

resolveFilePaths bool

Set to true to resolve paths using GetFullPath(string).

filePaths string[]

Sets the value of the file input to these paths. Paths are resolved using GetFullPath(string).

Returns

Task

Task.

Remarks

This method expects elementHandle to point to an input elementhttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/input.