pl.wendigo.chrome.api.target / TargetOperations

TargetOperations

class TargetOperations (source)

Supports additional targets discovery and allows to attach to them.

Link
Protocol Target domain documentation.

Functions

activateTarget

fun activateTarget(input: ActivateTargetRequest): Single<ResponseFrame>

Activates (focuses) the target.

attachedToTarget

fun attachedToTarget(): Flowable<AttachedToTargetEvent>

Issued when attached to target because of auto-attach or attachToTarget command.

attachToBrowserTarget

fun attachToBrowserTarget(): Single<AttachToBrowserTargetResponse>

Attaches to the browser target, only uses flat sessionId mode.

attachToTarget

fun attachToTarget(input: AttachToTargetRequest): Single<AttachToTargetResponse>

Attaches to the target with given id.

closeTarget

fun closeTarget(input: CloseTargetRequest): Single<CloseTargetResponse>

Closes the target. If the target is a page that gets closed too.

createBrowserContext

fun createBrowserContext(): Single<CreateBrowserContextResponse>

Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.

createTarget

fun createTarget(input: CreateTargetRequest): Single<CreateTargetResponse>

Creates a new page.

detachedFromTarget

fun detachedFromTarget(): Flowable<DetachedFromTargetEvent>

Issued when detached from target for any reason (including detachFromTarget command). Can be issued multiple times per target if multiple sessions have been attached to it.

detachFromTarget

fun detachFromTarget(input: DetachFromTargetRequest): Single<ResponseFrame>

Detaches session with given id.

disposeBrowserContext

fun disposeBrowserContext(input: DisposeBrowserContextRequest): Single<ResponseFrame>

Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.

events

fun events(): Flowable<Event>

Returns flowable capturing all Target domains events.

exposeDevToolsProtocol

fun exposeDevToolsProtocol(input: ExposeDevToolsProtocolRequest): Single<ResponseFrame>

Inject object to the target's main frame that provides a communication channel with browser target.

getBrowserContexts

fun getBrowserContexts(): Single<GetBrowserContextsResponse>

Returns all browser contexts created with Target.createBrowserContext method.

getTargetInfo

fun getTargetInfo(input: GetTargetInfoRequest): Single<GetTargetInfoResponse>

Returns information about a target.

getTargets

fun getTargets(): Single<GetTargetsResponse>

Retrieves a list of available targets.

receivedMessageFromTarget

fun receivedMessageFromTarget(): Flowable<ReceivedMessageFromTargetEvent>

Notifies about a new protocol message received from the session (as reported in attachedToTarget event).

sendMessageToTarget

fun sendMessageToTarget(input: SendMessageToTargetRequest): Single<ResponseFrame>

Sends protocol message over session with given id. Consider using flat mode instead; see commands attachToTarget, setAutoAttach, and crbug.com/991325.

setAutoAttach

fun setAutoAttach(input: SetAutoAttachRequest): Single<ResponseFrame>

Controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets.

setDiscoverTargets

fun setDiscoverTargets(input: SetDiscoverTargetsRequest): Single<ResponseFrame>

Controls whether to discover available targets and notify via targetCreated/targetInfoChanged/targetDestroyed events.

setRemoteLocations

fun setRemoteLocations(input: SetRemoteLocationsRequest): Single<ResponseFrame>

Enables target discovery for the specified locations, when setDiscoverTargets was set to true.

targetCrashed

fun targetCrashed(): Flowable<TargetCrashedEvent>

Issued when a target has crashed.

targetCreated

fun targetCreated(): Flowable<TargetCreatedEvent>

Issued when a possible inspection target is created.

targetDestroyed

fun targetDestroyed(): Flowable<TargetDestroyedEvent>

Issued when a target is destroyed.

targetInfoChanged

fun targetInfoChanged(): Flowable<TargetInfoChangedEvent>

Issued when some information about a target has changed. This only happens between targetCreated and targetDestroyed.