/** * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /// /// import type { Readable } from 'stream'; import type { Protocol } from 'devtools-protocol'; import type { Browser } from '../api/Browser.js'; import type { BrowserContext } from '../api/BrowserContext.js'; import { type CDPSession } from '../api/CDPSession.js'; import type { Frame, WaitForOptions } from '../api/Frame.js'; import type { HTTPRequest } from '../api/HTTPRequest.js'; import type { HTTPResponse } from '../api/HTTPResponse.js'; import type { JSHandle } from '../api/JSHandle.js'; import { Page, type GeolocationOptions, type MediaFeature, type Metrics, type NewDocumentScriptEvaluation, type ScreenshotOptions, type WaitTimeoutOptions } from '../api/Page.js'; import { FileChooser } from '../common/FileChooser.js'; import type { PDFOptions } from '../common/PDFOptions.js'; import type { Viewport } from '../common/Viewport.js'; import { Accessibility } from './Accessibility.js'; import { Coverage } from './Coverage.js'; import type { DeviceRequestPrompt } from './DeviceRequestPrompt.js'; import type { CdpFrame } from './Frame.js'; import { CdpKeyboard, CdpMouse, CdpTouchscreen } from './Input.js'; import type { Credentials, NetworkConditions } from './NetworkManager.js'; import type { CdpTarget } from './Target.js'; import { Tracing } from './Tracing.js'; import { WebWorker } from './WebWorker.js'; /** * @internal */ export declare class CdpPage extends Page { #private; static _create(client: CDPSession, target: CdpTarget, ignoreHTTPSErrors: boolean, defaultViewport: Viewport | null): Promise; constructor(client: CDPSession, target: CdpTarget, ignoreHTTPSErrors: boolean); _client(): CDPSession; isServiceWorkerBypassed(): boolean; isDragInterceptionEnabled(): boolean; isJavaScriptEnabled(): boolean; waitForFileChooser(options?: WaitTimeoutOptions): Promise; setGeolocation(options: GeolocationOptions): Promise; target(): CdpTarget; browser(): Browser; browserContext(): BrowserContext; mainFrame(): CdpFrame; get keyboard(): CdpKeyboard; get touchscreen(): CdpTouchscreen; get coverage(): Coverage; get tracing(): Tracing; get accessibility(): Accessibility; frames(): Frame[]; workers(): WebWorker[]; setRequestInterception(value: boolean): Promise; setBypassServiceWorker(bypass: boolean): Promise; setDragInterception(enabled: boolean): Promise; setOfflineMode(enabled: boolean): Promise; emulateNetworkConditions(networkConditions: NetworkConditions | null): Promise; setDefaultNavigationTimeout(timeout: number): void; setDefaultTimeout(timeout: number): void; getDefaultTimeout(): number; queryObjects(prototypeHandle: JSHandle): Promise>; cookies(...urls: string[]): Promise; deleteCookie(...cookies: Protocol.Network.DeleteCookiesRequest[]): Promise; setCookie(...cookies: Protocol.Network.CookieParam[]): Promise; exposeFunction(name: string, pptrFunction: Function | { default: Function; }): Promise; removeExposedFunction(name: string): Promise; authenticate(credentials: Credentials): Promise; setExtraHTTPHeaders(headers: Record): Promise; setUserAgent(userAgent: string, userAgentMetadata?: Protocol.Emulation.UserAgentMetadata): Promise; metrics(): Promise; reload(options?: WaitForOptions): Promise; createCDPSession(): Promise; waitForRequest(urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise), options?: { timeout?: number; }): Promise; waitForResponse(urlOrPredicate: string | ((res: HTTPResponse) => boolean | Promise), options?: { timeout?: number; }): Promise; waitForNetworkIdle(options?: { idleTime?: number; timeout?: number; }): Promise; goBack(options?: WaitForOptions): Promise; goForward(options?: WaitForOptions): Promise; bringToFront(): Promise; setJavaScriptEnabled(enabled: boolean): Promise; setBypassCSP(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): Promise; viewport(): Viewport | null; evaluateOnNewDocument unknown = (...args: Params) => unknown>(pageFunction: Func | string, ...args: Params): Promise; removeScriptToEvaluateOnNewDocument(identifier: string): Promise; setCacheEnabled(enabled?: boolean): Promise; _screenshot(options: Readonly): Promise; createPDFStream(options?: PDFOptions): Promise; pdf(options?: PDFOptions): Promise; close(options?: { runBeforeUnload?: boolean; }): Promise; isClosed(): boolean; get mouse(): CdpMouse; /** * This method is typically coupled with an action that triggers a device * request from an api such as WebBluetooth. * * :::caution * * This must be called before the device request is made. It will not return a * currently active device prompt. * * ::: * * @example * * ```ts * const [devicePrompt] = Promise.all([ * page.waitForDevicePrompt(), * page.click('#connect-bluetooth'), * ]); * await devicePrompt.select( * await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) * ); * ``` */ waitForDevicePrompt(options?: WaitTimeoutOptions): Promise; } //# sourceMappingURL=Page.d.ts.map