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
RemoteObject
CDP Remote object.
public RemoteObject RemoteObject { get; }
Property Value
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
dataAutofillDataThe 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
ContentFrameAsync()
Resolves the frame associated with the element..
public override Task<IFrame> ContentFrameAsync()
Returns
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
resolveFilePathsboolSet to true to resolve paths using GetFullPath(string).
filePathsstring[]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.