Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pptr/src/Target.ts>Target

Headless Chrome Deno API
Latest
class Target
import { Target } from "https://deno.land/x/pptr@1.2.0/src/Target.ts";

Constructors

new
Target(
targetInfo: Protocol.Target.TargetInfo,
browserContext: BrowserContext,
sessionFactory: () => Promise<CDPSession>,
ignoreHTTPSErrors: boolean,
defaultViewport: Viewport | null,
)

Properties

private
_browserContext: BrowserContext
private
optional
_defaultViewport: Viewport
private
_ignoreHTTPSErrors: boolean
private
optional
_pagePromise: Promise<Page>
private
_sessionFactory: () => Promise<CDPSession>
private
_targetInfo: Protocol.Target.TargetInfo
private
optional
_workerPromise: Promise<WebWorker>
_closedCallback: () => void
_initializedCallback: (x: boolean) => void
_initializedPromise: Promise<boolean>
_isClosedPromise: Promise<void>
_isInitialized: boolean
_targetId: string

Methods

_targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void

Get the browser the target belongs to.

Creates a Chrome Devtools Protocol session attached to the target.

opener(): Target | null

Get the target that opened this target. Top-level targets return null.

page(): Promise<Page | null>

If the target is not of type "page" or "background_page", returns null.

type():
| "page"
| "background_page"
| "service_worker"
| "shared_worker"
| "other"
| "browser"
| "webview"

Identifies what kind of target this is.

url(): string
worker(): Promise<WebWorker | null>

If the target is not of type "service_worker" or "shared_worker", returns null.