Skip to main content
Module

x/puppeteer/mod.ts>Target

A port of puppeteer running on Deno
Latest
class Target
Re-export
import { Target } from "https://deno.land/x/puppeteer@16.2.0/mod.ts";

Constructors

new
Target(
targetInfo: Protocol.Target.TargetInfo,
session: CDPSession | undefined,
browserContext: BrowserContext,
targetManager: TargetManager,
sessionFactory: (isAutoAttachEmulated: boolean) => Promise<CDPSession>,
ignoreHTTPSErrors: boolean,
defaultViewport: Viewport | null,
screenshotTaskQueue: TaskQueue,
isPageTargetCallback: IsPageTargetCallback,
)

Properties

_closedCallback: () => void
_initializedCallback: (x: boolean) => void
_initializedPromise: Promise<boolean>
_isClosedPromise: Promise<void>
_isInitialized: boolean
_isPageTargetCallback: IsPageTargetCallback
_targetId: string

Methods

_getTargetInfo(): Protocol.Target.TargetInfo
_session(): CDPSession | undefined
_targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void
_targetManager(): TargetManager
browser(): Browser

Get the browser the target belongs to.

browserContext(): BrowserContext

Get the browser context the target belongs to.

createCDPSession(): Promise<CDPSession>

Creates a Chrome Devtools Protocol session attached to the target.

opener(): Target | undefined

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.