Target
Namespace: PuppeteerSharp
public abstract class Target : ITargetTarget.
Inheritance: object
Implements: ITarget
Derived: CdpTarget
Properties
Section titled “Properties”Opener
Section titled “Opener”public abstract ITarget Opener { get; }Get the target that opened this target.
Value: ITarget
Top-level targets return null.
public abstract TargetType Type { get; }Gets the type. It will be Type.
Can be "page", "background_page", "service_worker", "shared_worker", "browser" or "other".
Value: TargetType — The type.
public abstract string Url { get; }Gets the URL.
Value: string — The URL.
Methods
Section titled “Methods”AsPageAsync()
Section titled “AsPageAsync()”public abstract Task<IPage> AsPageAsync()Forcefully creates a page for a target of any type. It is useful if you
want to handle a CDP target of type other as a page. If you deal with a
regular page target, use PageAsync().
Returns: Task<IPage> — A task that returns a IPage.
CreateCDPSessionAsync()
Section titled “CreateCDPSessionAsync()”public abstract Task<ICDPSession> CreateCDPSessionAsync()Creates a Chrome Devtools Protocol session attached to the target.
Returns: Task<ICDPSession> — A task that returns a ICDPSession.
PageAsync()
Section titled “PageAsync()”public virtual Task<IPage> PageAsync()Returns the IPage associated with the target. If the target is not "page", "webview" or "background_page" returns null.
Returns: Task<IPage> — a task that returns a IPage.
WorkerAsync()
Section titled “WorkerAsync()”public virtual Task<WebWorker> WorkerAsync()If the target is not of type "service_worker" or "shared_worker", returns null.
Returns: Task<WebWorker> — A task that returns a WebWorker.
Made with love by Dario Kondratiuk