Table of Contents

Class Target

Namespace
OpenQA.Selenium.DevTools
Assembly
WebDriver.dll

Class representing a target for DevTools Protocol commands

public abstract class Target
Inheritance
Target
Derived
Inherited Members

Methods

AttachToTarget(string)

Asynchronously attaches to a target.

public abstract Task<string> AttachToTarget(string targetId)

Parameters

targetId string

The ID of the target to which to attach.

Returns

Task<string>

A task representing the asynchronous attach operation. The task result contains the session ID established for commands to the target attached to.

DetachFromTarget(string, string)

Asynchronously detaches from a target.

public abstract Task DetachFromTarget(string sessionId = null, string targetId = null)

Parameters

sessionId string

The ID of the session of the target from which to detach.

targetId string

The ID of the target from which to detach.

Returns

Task

A task representing the asynchronous detach operation.

GetTargets(object)

Asynchronously gets the targets available for this session.

public abstract Task<ReadOnlyCollection<TargetInfo>> GetTargets(object settings = null)

Parameters

settings object

Returns

Task<ReadOnlyCollection<TargetInfo>>

A task that represents the asynchronous operation. The task result contains the list of TargetInfo objects describing the targets available for this session.

OnTargetAttached(TargetAttachedEventArgs)

Raises the TargetAttached event.

protected virtual void OnTargetAttached(TargetAttachedEventArgs e)

Parameters

e TargetAttachedEventArgs

OnTargetDetached(TargetDetachedEventArgs)

Raises the TargetDetached event.

protected virtual void OnTargetDetached(TargetDetachedEventArgs e)

Parameters

e TargetDetachedEventArgs

An TargetDetachedEventArgs that contains the event data.

SetAutoAttach()

Asynchronously sets the DevTools Protocol connection to automatically attach to new targets.

public abstract Task SetAutoAttach()

Returns

Task

A task that represents the asynchronous operation.

Events

TargetAttached

Occurs when a target is attached.

public event EventHandler<TargetAttachedEventArgs> TargetAttached

Event Type

EventHandler<TargetAttachedEventArgs>

TargetDetached

Occurs when a target is detached.

public event EventHandler<TargetDetachedEventArgs> TargetDetached

Event Type

EventHandler<TargetDetachedEventArgs>