/** * @license * Copyright 2022 Google Inc. * SPDX-License-Identifier: Apache-2.0 */ import type Protocol from 'devtools-protocol'; import * as Bidi from 'webdriver-bidi-protocol'; import type { CDPSession } from '../api/CDPSession.js'; import type { WaitForOptions } from '../api/Frame.js'; import type { HTTPResponse } from '../api/HTTPResponse.js'; import type { Credentials, GeolocationOptions, MediaFeature, PageEvents, ReloadOptions, WaitTimeoutOptions } from '../api/Page.js'; import { Page, type NewDocumentScriptEvaluation, type ScreenshotOptions } from '../api/Page.js'; import { Coverage } from '../cdp/Coverage.js'; import type { NetworkConditions } from '../cdp/NetworkManager.js'; import { Tracing } from '../cdp/Tracing.js'; import type { CookiePartitionKey, Cookie, CookieParam, CookieSameSite, DeleteCookiesRequest } from '../common/Cookie.js'; import { EventEmitter } from '../common/EventEmitter.js'; import { FileChooser } from '../common/FileChooser.js'; import type { PDFOptions } from '../common/PDFOptions.js'; import type { Awaitable } from '../common/types.js'; import type { Viewport } from '../common/Viewport.js'; import type { BidiBrowser } from './Browser.js'; import type { BidiBrowserContext } from './BrowserContext.js'; import type { BidiCdpSession } from './CDPSession.js'; import type { BrowsingContext } from './core/BrowsingContext.js'; import { BidiFrame } from './Frame.js'; import type { BidiHTTPResponse } from './HTTPResponse.js'; import { BidiKeyboard, BidiMouse, BidiTouchscreen } from './Input.js'; import type { BidiJSHandle } from './JSHandle.js'; import type { BidiWebWorker } from './WebWorker.js'; /** * Implements Page using WebDriver BiDi. * * @internal */ export declare class BidiPage extends Page { #private; static from(browserContext: BidiBrowserContext, browsingContext: BrowsingContext): BidiPage; accessor trustedEmitter: EventEmitter; readonly keyboard: BidiKeyboard; readonly mouse: BidiMouse; readonly touchscreen: BidiTouchscreen; readonly tracing: Tracing; readonly coverage: Coverage; _client(): BidiCdpSession; private constructor(); /** * @internal */ _userAgentHeaders: Record; setUserAgent(userAgentOrOptions: string | { userAgent?: string; userAgentMetadata?: Protocol.Emulation.UserAgentMetadata; platform?: string; }, userAgentMetadata?: Protocol.Emulation.UserAgentMetadata): Promise; setBypassCSP(enabled: boolean): Promise; queryObjects(prototypeHandle: BidiJSHandle): Promise>; browser(): BidiBrowser; browserContext(): BidiBrowserContext; mainFrame(): BidiFrame; resize(_params: { contentWidth: number; contentHeight: number; }): Promise; openDevTools(): Promise; focusedFrame(): Promise; frames(): BidiFrame[]; isClosed(): boolean; close(options?: { runBeforeUnload?: boolean; }): Promise; reload(options?: ReloadOptions): Promise; setDefaultNavigationTimeout(timeout: number): void; setDefaultTimeout(timeout: number): void; getDefaultTimeout(): number; getDefaultNavigationTimeout(): number; isJavaScriptEnabled(): boolean; setGeolocation(options: GeolocationOptions): Promise; setJavaScriptEnabled(enabled: boolean): Promise; emulateMediaType(type?: string): Promise; emulateCPUThrottling(factor: number | null): Promise; emulateMediaFeatures(features?: MediaFeature[]): Promise; emulateTimezone(timezoneId?: string): Promise; emulateIdleState(overrides?: { isUserActive: boolean; isScreenUnlocked: boolean; }): Promise; emulateVisionDeficiency(type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']): Promise; setViewport(viewport: Viewport | null): Promise; viewport(): Viewport | null; pdf(options?: PDFOptions): Promise; createPDFStream(options?: PDFOptions | undefined): Promise>; _screenshot(options: Readonly): Promise; createCDPSession(): Promise; bringToFront(): Promise; evaluateOnNewDocument unknown = (...args: Params) => unknown>(pageFunction: Func | string, ...args: Params): Promise; removeScriptToEvaluateOnNewDocument(id: string): Promise; exposeFunction(name: string, pptrFunction: ((...args: Args) => Awaitable) | { default: (...args: Args) => Awaitable; }): Promise; isDragInterceptionEnabled(): boolean; setCacheEnabled(enabled?: boolean): Promise; cookies(...urls: string[]): Promise; isServiceWorkerBypassed(): never; target(): never; waitForFileChooser(options?: WaitTimeoutOptions): Promise; workers(): BidiWebWorker[]; get isNetworkInterceptionEnabled(): boolean; setRequestInterception(enable: boolean): Promise; /** * @internal */ _extraHTTPHeaders: Record; setExtraHTTPHeaders(headers: Record): Promise; /** * @internal */ _credentials: Credentials | null; authenticate(credentials: Credentials | null): Promise; setDragInterception(): never; setBypassServiceWorker(): never; setOfflineMode(enabled: boolean): Promise; emulateNetworkConditions(networkConditions: NetworkConditions | null): Promise; setCookie(...cookies: CookieParam[]): Promise; deleteCookie(...cookies: DeleteCookiesRequest[]): Promise; removeExposedFunction(name: string): Promise; metrics(): never; goBack(options?: WaitForOptions): Promise; goForward(options?: WaitForOptions): Promise; waitForDevicePrompt(): never; } export declare function bidiToPuppeteerCookie(bidiCookie: Bidi.Network.Cookie, returnCompositePartitionKey?: boolean): Cookie; /** * Gets CDP-specific properties from the cookie, adds CDP-specific prefixes and returns * them as a new object which can be used in BiDi. */ export declare function cdpSpecificCookiePropertiesFromPuppeteerToBidi(cookieParam: CookieParam, ...propertyNames: Array): Record; export declare function convertCookiesSameSiteCdpToBiDi(sameSite: CookieSameSite | undefined): Bidi.Network.SameSite; export declare function convertCookiesExpiryCdpToBiDi(expiry: number | undefined): number | undefined; export declare function convertCookiesPartitionKeyFromPuppeteerToBiDi(partitionKey: CookiePartitionKey | string | undefined): string | undefined; //# sourceMappingURL=Page.d.ts.map