/** * @license * Copyright 2024 Google Inc. * SPDX-License-Identifier: Apache-2.0 */ import type * as Bidi from 'webdriver-bidi-protocol'; import { EventEmitter } from '../../common/EventEmitter.js'; import { disposeSymbol } from '../../util/disposable.js'; import type { AddPreloadScriptOptions } from './Browser.js'; import { Navigation } from './Navigation.js'; import type { DedicatedWorkerRealm } from './Realm.js'; import { WindowRealm } from './Realm.js'; import { Request } from './Request.js'; import type { UserContext } from './UserContext.js'; import { UserPrompt } from './UserPrompt.js'; /** * @internal */ export type AddInterceptOptions = Omit; /** * @internal */ export type CaptureScreenshotOptions = Omit; /** * @internal */ export type ReloadOptions = Omit; /** * @internal */ export type PrintOptions = Omit; /** * @internal */ export type HandleUserPromptOptions = Omit; /** * @internal */ export type SetViewportOptions = Omit; /** * @internal */ export type GetCookiesOptions = Omit; /** * @internal */ export type SetGeoLocationOverrideOptions = Bidi.Emulation.SetGeolocationOverrideParameters; /** * @internal */ export declare class BrowsingContext extends EventEmitter<{ /** Emitted when this context is closed. */ closed: { /** The reason the browsing context was closed */ reason: string; }; /** Emitted when a child browsing context is created. */ browsingcontext: { /** The newly created child browsing context. */ browsingContext: BrowsingContext; }; /** Emitted whenever a navigation occurs. */ navigation: { /** The navigation that occurred. */ navigation: Navigation; }; /** Emitted whenever a file dialog is opened occurs. */ filedialogopened: Bidi.Input.FileDialogInfo; /** Emitted whenever a request is made. */ request: { /** The request that was made. */ request: Request; }; /** Emitted whenever a log entry is added. */ log: { /** Entry added to the log. */ entry: Bidi.Log.Entry; }; /** Emitted whenever a prompt is opened. */ userprompt: { /** The prompt that was opened. */ userPrompt: UserPrompt; }; /** Emitted whenever the frame history is updated. */ historyUpdated: void; /** Emitted whenever the frame emits `DOMContentLoaded` */ DOMContentLoaded: void; /** Emitted whenever the frame emits `load` */ load: void; /** Emitted whenever a dedicated worker is created */ worker: { /** The realm for the new dedicated worker */ realm: DedicatedWorkerRealm; }; }> { #private; static from(userContext: UserContext, parent: BrowsingContext | undefined, id: string, url: string, originalOpener: string | null): BrowsingContext; readonly defaultRealm: WindowRealm; readonly id: string; readonly parent: BrowsingContext | undefined; readonly userContext: UserContext; readonly originalOpener: string | null; private constructor(); get children(): Iterable; get closed(): boolean; get disposed(): boolean; get realms(): Iterable; get top(): BrowsingContext; get url(): string; private dispose; activate(): Promise; captureScreenshot(options?: CaptureScreenshotOptions): Promise; close(promptUnload?: boolean): Promise; traverseHistory(delta: number): Promise; navigate(url: string, wait?: Bidi.BrowsingContext.ReadinessState): Promise; reload(options?: ReloadOptions): Promise; setCacheBehavior(cacheBehavior: 'default' | 'bypass'): Promise; print(options?: PrintOptions): Promise; handleUserPrompt(options?: HandleUserPromptOptions): Promise; setViewport(options?: SetViewportOptions): Promise; performActions(actions: Bidi.Input.SourceActions[]): Promise; releaseActions(): Promise; createWindowRealm(sandbox: string): WindowRealm; addPreloadScript(functionDeclaration: string, options?: AddPreloadScriptOptions): Promise; addIntercept(options: AddInterceptOptions): Promise; removePreloadScript(script: string): Promise; setGeolocationOverride(options: SetGeoLocationOverrideOptions): Promise; setTimezoneOverride(timezoneId?: string): Promise; setScreenOrientationOverride(screenOrientation: Bidi.Emulation.ScreenOrientation | null): Promise; getCookies(options?: GetCookiesOptions): Promise; setCookie(cookie: Bidi.Storage.PartialCookie): Promise; setFiles(element: Bidi.Script.SharedReference, files: string[]): Promise; subscribe(events: [string, ...string[]]): Promise; addInterception(events: [string, ...string[]]): Promise; [disposeSymbol](): void; deleteCookie(...cookieFilters: Bidi.Storage.CookieFilter[]): Promise; locateNodes(locator: Bidi.BrowsingContext.Locator, startNodes: [Bidi.Script.SharedReference, ...Bidi.Script.SharedReference[]]): Promise; setJavaScriptEnabled(enabled: boolean): Promise; isJavaScriptEnabled(): boolean; } //# sourceMappingURL=BrowsingContext.d.ts.map