Skip to content

CdpElementHandle

Namespace: PuppeteerSharp.Cdp

public class CdpElementHandle : ElementHandle, IElementHandle, ICdpHandle, IJSHandle, IAsyncDisposable

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

Inheritance: object → JSHandle → ElementHandle

Implements: IElementHandle, ICdpHandle, IJSHandle, IAsyncDisposable

View source

protected override Page Page { get; }

Element’s page.

Value: Page

View source

public RemoteObject RemoteObject { get; }

CDP Remote object.

Value: RemoteObject

View source

public override Task AutofillAsync(AutofillData data)

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.

Parameters

Name Type Description
data AutofillData The autofill data.

Returns: Task — A task that resolves when the autofill is complete.

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

View source

public override Task<int> BackendNodeIdAsync()

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

Returns: Task<int> — A task that resolves to the backend node ID.

View source

public override Task<IFrame> ContentFrameAsync()

Resolves the frame associated with the element..

Returns: Task<IFrame> — Task which resolves to the frame associated with the element.

View source

public override Task ScrollIntoViewAsync()

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

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

View source

public override string ToString()

Returns a string that represents the current object.

Returns: string — A string that represents the current object.

View source

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

Uploads files.

Parameters

Name Type Description
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.

This method expects elementHandle to point to an input element <a href=“https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input"&gt;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input&lt;/a>.

View source

Made with love by Dario Kondratiuk