CdpElementHandle
Namespace: PuppeteerSharp.Cdp
public class CdpElementHandle : ElementHandle, IElementHandle, ICdpHandle, IJSHandle, IAsyncDisposableInherits 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
Properties
Section titled “Properties”protected override Page Page { get; }Element’s page.
Value: Page
RemoteObject
Section titled “RemoteObject”public RemoteObject RemoteObject { get; }CDP Remote object.
Value: RemoteObject
Methods
Section titled “Methods”AutofillAsync(AutofillData)
Section titled “AutofillAsync(AutofillData)”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.
BackendNodeIdAsync()
Section titled “BackendNodeIdAsync()”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.
ContentFrameAsync()
Section titled “ContentFrameAsync()”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.
ScrollIntoViewAsync()
Section titled “ScrollIntoViewAsync()”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.
ToString()
Section titled “ToString()”public override string ToString()Returns a string that represents the current object.
Returns: string — A string that represents the current object.
UploadFileAsync(bool, params string[])
Section titled “UploadFileAsync(bool, params string[])”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">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input</a>.
Made with love by Dario Kondratiuk