Table of Contents

Class CdpTarget

Namespace
PuppeteerSharp.Cdp
Assembly
PuppeteerSharp.dll

Target.

public class CdpTarget : Target, ITarget
Inheritance
CdpTarget
Implements
Derived

Properties

Opener

Get the target that opened this target.

public override ITarget Opener { get; }

Property Value

ITarget

Remarks

Top-level targets return null.

TargetId

Gets the target identifier.

public string TargetId { get; }

Property Value

string

The target identifier.

Type

Gets the type. It will be Type. Can be "page", "background_page", "service_worker", "shared_worker", "browser" or "other".

public override TargetType Type { get; }

Property Value

TargetType

The type.

Url

Gets the URL.

public override string Url { get; }

Property Value

string

The URL.

Methods

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().

public override Task<IPage> AsPageAsync()

Returns

Task<IPage>

A task that returns a IPage.

CheckIfInitialized()

Check is the target is not initialized.

protected virtual void CheckIfInitialized()

CreateCDPSessionAsync()

Creates a Chrome Devtools Protocol session attached to the target.

public override Task<ICDPSession> CreateCDPSessionAsync()

Returns

Task<ICDPSession>

A task that returns a ICDPSession.