2020-06-25 16:05:36 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) Microsoft Corporation.
|
|
|
|
*
|
|
|
|
* 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 { EventEmitter } from 'events';
|
|
|
|
import * as types from '../types';
|
|
|
|
|
2020-06-29 16:37:38 -07:00
|
|
|
export type Binary = string;
|
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface Channel extends EventEmitter {
|
|
|
|
}
|
|
|
|
|
2020-06-30 10:55:11 -07:00
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface BrowserTypeChannel extends Channel {
|
2020-06-26 11:51:47 -07:00
|
|
|
connect(params: { options: types.ConnectOptions }): Promise<BrowserChannel>;
|
2020-06-25 16:05:36 -07:00
|
|
|
launch(params: { options?: types.LaunchOptions }): Promise<BrowserChannel>;
|
2020-06-30 10:55:11 -07:00
|
|
|
launchServer(params: { options?: types.LaunchServerOptions }): Promise<BrowserServerChannel>;
|
2020-06-25 16:05:36 -07:00
|
|
|
launchPersistentContext(params: { userDataDir: string, options?: types.LaunchOptions & types.BrowserContextOptions }): Promise<BrowserContextChannel>;
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type BrowserTypeInitializer = {
|
|
|
|
executablePath: string,
|
|
|
|
name: string
|
|
|
|
};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-30 10:55:11 -07:00
|
|
|
export interface BrowserServerChannel extends Channel {
|
|
|
|
on(event: 'close', callback: () => void): this;
|
|
|
|
|
|
|
|
close(): Promise<void>;
|
|
|
|
kill(): Promise<void>;
|
|
|
|
}
|
|
|
|
export type BrowserServerInitializer = {
|
|
|
|
wsEndpoint: string,
|
|
|
|
pid: number
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface BrowserChannel extends Channel {
|
2020-06-30 10:55:11 -07:00
|
|
|
on(event: 'close', callback: () => void): this;
|
|
|
|
|
2020-06-26 11:51:47 -07:00
|
|
|
close(): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
newContext(params: { options?: types.BrowserContextOptions }): Promise<BrowserContextChannel>;
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type BrowserInitializer = {};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface BrowserContextChannel extends Channel {
|
2020-06-26 22:38:21 -07:00
|
|
|
on(event: 'bindingCall', callback: (params: BindingCallChannel) => void): this;
|
2020-06-30 10:55:11 -07:00
|
|
|
on(event: 'close', callback: () => void): this;
|
2020-06-26 22:38:21 -07:00
|
|
|
on(event: 'page', callback: (params: PageChannel) => void): this;
|
2020-06-30 10:55:11 -07:00
|
|
|
on(event: 'route', callback: (params: { route: RouteChannel, request: RequestChannel }) => void): this;
|
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
addCookies(params: { cookies: types.SetNetworkCookieParam[] }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
addInitScript(params: { source: string }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
clearCookies(): Promise<void>;
|
|
|
|
clearPermissions(): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
close(): Promise<void>;
|
|
|
|
cookies(params: { urls: string[] }): Promise<types.NetworkCookie[]>;
|
|
|
|
exposeBinding(params: { name: string }): Promise<void>;
|
|
|
|
grantPermissions(params: { permissions: string[]; options?: { origin?: string } }): Promise<void>;
|
|
|
|
newPage(): Promise<PageChannel>;
|
|
|
|
setDefaultNavigationTimeoutNoReply(params: { timeout: number }): void;
|
|
|
|
setDefaultTimeoutNoReply(params: { timeout: number }): void;
|
2020-06-25 16:05:36 -07:00
|
|
|
setExtraHTTPHeaders(params: { headers: types.Headers }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
setGeolocation(params: { geolocation: types.Geolocation | null }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
setHTTPCredentials(params: { httpCredentials: types.Credentials | null }): Promise<void>;
|
|
|
|
setNetworkInterceptionEnabled(params: { enabled: boolean }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
setOffline(params: { offline: boolean }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
waitForEvent(params: { event: string }): Promise<any>;
|
|
|
|
}
|
2020-06-26 17:24:21 -07:00
|
|
|
export type BrowserContextInitializer = {
|
|
|
|
pages: PageChannel[]
|
|
|
|
};
|
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
|
|
|
|
export interface PageChannel extends Channel {
|
2020-06-26 11:51:47 -07:00
|
|
|
on(event: 'bindingCall', callback: (params: BindingCallChannel) => void): this;
|
|
|
|
on(event: 'close', callback: () => void): this;
|
|
|
|
on(event: 'console', callback: (params: ConsoleMessageChannel) => void): this;
|
2020-06-26 21:22:03 -07:00
|
|
|
on(event: 'crash', callback: () => void): this;
|
2020-06-26 17:24:21 -07:00
|
|
|
on(event: 'dialog', callback: (params: DialogChannel) => void): this;
|
|
|
|
on(event: 'download', callback: (params: DownloadChannel) => void): this;
|
2020-06-26 21:22:03 -07:00
|
|
|
on(event: 'domcontentloaded', callback: () => void): this;
|
2020-06-30 10:55:11 -07:00
|
|
|
on(event: 'fileChooser', callback: (params: { element: ElementHandleChannel, isMultiple: boolean }) => void): this;
|
2020-06-25 16:05:36 -07:00
|
|
|
on(event: 'frameAttached', callback: (params: FrameChannel) => void): this;
|
|
|
|
on(event: 'frameDetached', callback: (params: FrameChannel) => void): this;
|
2020-06-26 11:51:47 -07:00
|
|
|
on(event: 'frameNavigated', callback: (params: { frame: FrameChannel, url: string, name: string }) => void): this;
|
|
|
|
on(event: 'frameNavigated', callback: (params: { frame: FrameChannel, url: string, name: string }) => void): this;
|
2020-06-26 21:22:03 -07:00
|
|
|
on(event: 'load', callback: () => void): this;
|
2020-06-26 11:51:47 -07:00
|
|
|
on(event: 'pageError', callback: (params: { error: types.Error }) => void): this;
|
2020-06-26 17:24:21 -07:00
|
|
|
on(event: 'popup', callback: (params: PageChannel) => void): this;
|
2020-06-25 16:05:36 -07:00
|
|
|
on(event: 'request', callback: (params: RequestChannel) => void): this;
|
2020-06-26 11:51:47 -07:00
|
|
|
on(event: 'requestFailed', callback: (params: { request: RequestChannel, failureText: string | null }) => void): this;
|
2020-06-25 16:05:36 -07:00
|
|
|
on(event: 'requestFinished', callback: (params: RequestChannel) => void): this;
|
2020-06-26 11:51:47 -07:00
|
|
|
on(event: 'response', callback: (params: ResponseChannel) => void): this;
|
|
|
|
on(event: 'route', callback: (params: { route: RouteChannel, request: RequestChannel }) => void): this;
|
2020-06-30 10:55:11 -07:00
|
|
|
on(event: 'worker', callback: (params: WorkerChannel) => void): this;
|
2020-06-25 16:05:36 -07:00
|
|
|
|
|
|
|
setDefaultNavigationTimeoutNoReply(params: { timeout: number }): void;
|
|
|
|
setDefaultTimeoutNoReply(params: { timeout: number }): Promise<void>;
|
|
|
|
setFileChooserInterceptedNoReply(params: { intercepted: boolean }): Promise<void>;
|
|
|
|
|
2020-06-26 11:51:47 -07:00
|
|
|
addInitScript(params: { source: string }): Promise<void>;
|
|
|
|
close(params: { options?: { runBeforeUnload?: boolean } }): Promise<void>;
|
|
|
|
emulateMedia(params: { options: { media?: 'screen' | 'print', colorScheme?: 'dark' | 'light' | 'no-preference' } }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
exposeBinding(params: { name: string }): Promise<void>;
|
|
|
|
goBack(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null>;
|
|
|
|
goForward(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null>;
|
2020-06-26 11:51:47 -07:00
|
|
|
opener(): Promise<PageChannel | null>;
|
|
|
|
reload(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null>;
|
2020-06-29 16:37:38 -07:00
|
|
|
screenshot(params: { options?: types.ScreenshotOptions }): Promise<Binary>;
|
2020-06-26 11:51:47 -07:00
|
|
|
setExtraHTTPHeaders(params: { headers: types.Headers }): Promise<void>;
|
|
|
|
setNetworkInterceptionEnabled(params: { enabled: boolean }): Promise<void>;
|
|
|
|
setViewportSize(params: { viewportSize: types.Size }): Promise<void>;
|
2020-06-25 18:01:18 -07:00
|
|
|
|
|
|
|
// Input
|
|
|
|
keyboardDown(params: { key: string }): Promise<void>;
|
|
|
|
keyboardUp(params: { key: string }): Promise<void>;
|
|
|
|
keyboardInsertText(params: { text: string }): Promise<void>;
|
|
|
|
keyboardType(params: { text: string, options?: { delay?: number } }): Promise<void>;
|
|
|
|
keyboardPress(params: { key: string, options?: { delay?: number } }): Promise<void>;
|
|
|
|
mouseMove(params: { x: number, y: number, options?: { steps?: number } }): Promise<void>;
|
|
|
|
mouseDown(params: { options?: { button?: types.MouseButton, clickCount?: number } }): Promise<void>;
|
|
|
|
mouseUp(params: { options?: { button?: types.MouseButton, clickCount?: number } }): Promise<void>;
|
|
|
|
mouseClick(params: { x: number, y: number, options?: { delay?: number, button?: types.MouseButton, clickCount?: number } }): Promise<void>;
|
|
|
|
|
|
|
|
// A11Y
|
|
|
|
accessibilitySnapshot(params: { options: { interestingOnly?: boolean, root?: ElementHandleChannel } }): Promise<types.SerializedAXNode | null>;
|
2020-06-30 10:55:11 -07:00
|
|
|
pdf: (params: { options?: types.PDFOptions }) => Promise<Binary>;
|
2020-06-25 16:05:36 -07:00
|
|
|
}
|
2020-06-30 10:55:11 -07:00
|
|
|
|
2020-06-26 12:28:27 -07:00
|
|
|
export type PageInitializer = {
|
|
|
|
mainFrame: FrameChannel,
|
|
|
|
viewportSize: types.Size | null
|
|
|
|
};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface FrameChannel extends Channel {
|
2020-07-03 18:04:08 -07:00
|
|
|
evalOnSelector(params: { selector: string; expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<any>;
|
|
|
|
evalOnSelectorAll(params: { selector: string; expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<any>;
|
2020-06-29 18:58:09 -07:00
|
|
|
addScriptTag(params: { options: { url?: string | undefined, path?: string | undefined, content?: string | undefined, type?: string | undefined }, isPage?: boolean }): Promise<ElementHandleChannel>;
|
|
|
|
addStyleTag(params: { options: { url?: string | undefined, path?: string | undefined, content?: string | undefined }, isPage?: boolean }): Promise<ElementHandleChannel>;
|
|
|
|
check(params: { selector: string, options: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void>;
|
|
|
|
click(params: { selector: string, options: types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
content(): Promise<string>;
|
2020-06-29 18:58:09 -07:00
|
|
|
dblclick(params: { selector: string, options: types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & { force?: boolean }, isPage?: boolean}): Promise<void>;
|
2020-06-30 10:55:11 -07:00
|
|
|
dispatchEvent(params: { selector: string, type: string, eventInit: any, options: types.TimeoutOptions, isPage?: boolean }): Promise<void>;
|
2020-06-29 18:58:09 -07:00
|
|
|
evaluateExpression(params: { expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<any>;
|
|
|
|
evaluateExpressionHandle(params: { expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<JSHandleChannel>;
|
|
|
|
fill(params: { selector: string, value: string, options: types.NavigatingActionWaitOptions, isPage?: boolean }): Promise<void>;
|
|
|
|
focus(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
frameElement(): Promise<ElementHandleChannel>;
|
2020-06-29 18:58:09 -07:00
|
|
|
getAttribute(params: { selector: string, name: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string | null>;
|
|
|
|
goto(params: { url: string, options: types.GotoOptions, isPage?: boolean }): Promise<ResponseChannel | null>;
|
|
|
|
hover(params: { selector: string, options: types.PointerActionOptions & types.TimeoutOptions & { force?: boolean }, isPage?: boolean }): Promise<void>;
|
|
|
|
innerHTML(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string>;
|
|
|
|
innerText(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string>;
|
|
|
|
press(params: { selector: string, key: string, options: { delay?: number | undefined } & types.TimeoutOptions & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void>;
|
|
|
|
querySelector(params: { selector: string, isPage?: boolean }): Promise<ElementHandleChannel | null>;
|
|
|
|
querySelectorAll(params: { selector: string, isPage?: boolean }): Promise<ElementHandleChannel[]>;
|
|
|
|
selectOption(params: { selector: string, values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null, options: types.NavigatingActionWaitOptions, isPage?: boolean }): Promise<string[]>;
|
|
|
|
setContent(params: { html: string, options: types.NavigateOptions, isPage?: boolean }): Promise<void>;
|
|
|
|
setInputFiles(params: { selector: string, files: { name: string, mimeType: string, buffer: string }[], options: types.NavigatingActionWaitOptions, isPage?: boolean }): Promise<void>;
|
|
|
|
textContent(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string | null>;
|
2020-06-26 11:51:47 -07:00
|
|
|
title(): Promise<string>;
|
2020-06-29 18:58:09 -07:00
|
|
|
type(params: { selector: string, text: string, options: { delay?: number | undefined } & types.TimeoutOptions & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void>;
|
|
|
|
uncheck(params: { selector: string, options: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void>;
|
|
|
|
waitForFunction(params: { expression: string, isFunction: boolean, arg: any; options: types.WaitForFunctionOptions, isPage?: boolean }): Promise<JSHandleChannel>;
|
|
|
|
waitForLoadState(params: { state: types.LifecycleEvent, options: types.TimeoutOptions, isPage?: boolean }): Promise<void>;
|
|
|
|
waitForNavigation(params: { options: types.WaitForNavigationOptions, isPage?: boolean }): Promise<ResponseChannel | null>;
|
|
|
|
waitForSelector(params: { selector: string, options: types.WaitForElementOptions, isPage?: boolean }): Promise<ElementHandleChannel | null>;
|
2020-06-25 16:05:36 -07:00
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type FrameInitializer = {
|
|
|
|
url: string,
|
|
|
|
name: string,
|
|
|
|
parentFrame: FrameChannel | null
|
|
|
|
};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-30 10:55:11 -07:00
|
|
|
export interface WorkerChannel extends Channel {
|
|
|
|
evaluateExpression(params: { expression: string, isFunction: boolean, arg: any }): Promise<any>;
|
|
|
|
evaluateExpressionHandle(params: { expression: string, isFunction: boolean, arg: any }): Promise<JSHandleChannel>;
|
|
|
|
}
|
|
|
|
export type WorkerInitializer = {
|
|
|
|
url: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface JSHandleChannel extends Channel {
|
2020-06-30 10:55:11 -07:00
|
|
|
on(event: 'previewUpdated', callback: (preview: string) => void): this;
|
|
|
|
|
2020-06-26 11:51:47 -07:00
|
|
|
dispose(): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
evaluateExpression(params: { expression: string, isFunction: boolean, arg: any }): Promise<any>;
|
|
|
|
evaluateExpressionHandle(params: { expression: string, isFunction: boolean, arg: any}): Promise<JSHandleChannel>;
|
|
|
|
getPropertyList(): Promise<{ name: string, value: JSHandleChannel}[]>;
|
2020-07-03 18:04:08 -07:00
|
|
|
getProperty(params: { name: string }): Promise<JSHandleChannel>;
|
2020-06-25 16:05:36 -07:00
|
|
|
jsonValue(): Promise<any>;
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type JSHandleInitializer = {
|
|
|
|
preview: string,
|
|
|
|
};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface ElementHandleChannel extends JSHandleChannel {
|
2020-07-03 18:04:08 -07:00
|
|
|
evalOnSelector(params: { selector: string; expression: string, isFunction: boolean, arg: any }): Promise<any>;
|
|
|
|
evalOnSelectorAll(params: { selector: string; expression: string, isFunction: boolean, arg: any }): Promise<any>;
|
2020-06-25 16:05:36 -07:00
|
|
|
boundingBox(): Promise<types.Rect | null>;
|
2020-06-26 11:51:47 -07:00
|
|
|
check(params: { options?: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
click(params: { options?: types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
contentFrame(): Promise<FrameChannel | null>;
|
2020-06-25 16:05:36 -07:00
|
|
|
dblclick(params: { options?: types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
dispatchEvent(params: { type: string, eventInit: any }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
fill(params: { value: string; options?: types.NavigatingActionWaitOptions }): Promise<void>;
|
|
|
|
focus(): Promise<void>;
|
2020-06-26 11:51:47 -07:00
|
|
|
getAttribute(params: { name: string }): Promise<string | null>;
|
|
|
|
hover(params: { options?: types.PointerActionOptions & types.TimeoutOptions & { force?: boolean } }): Promise<void>;
|
|
|
|
innerHTML(): Promise<string>;
|
|
|
|
innerText(): Promise<string>;
|
|
|
|
ownerFrame(): Promise<FrameChannel | null>;
|
2020-06-25 16:05:36 -07:00
|
|
|
press(params: { key: string; options?: { delay?: number } & types.TimeoutOptions & { noWaitAfter?: boolean } }): Promise<void>;
|
|
|
|
querySelector(params: { selector: string }): Promise<ElementHandleChannel | null>;
|
|
|
|
querySelectorAll(params: { selector: string }): Promise<ElementHandleChannel[]>;
|
2020-06-29 16:37:38 -07:00
|
|
|
screenshot(params: { options?: types.ElementScreenshotOptions }): Promise<Binary>;
|
2020-06-26 11:51:47 -07:00
|
|
|
scrollIntoViewIfNeeded(params: { options?: types.TimeoutOptions }): Promise<void>;
|
|
|
|
selectOption(params: { values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null; options?: types.NavigatingActionWaitOptions }): string[] | Promise<string[]>;
|
|
|
|
selectText(params: { options?: types.TimeoutOptions }): Promise<void>;
|
|
|
|
setInputFiles(params: { files: string | string[] | types.FilePayload | types.FilePayload[], options?: types.NavigatingActionWaitOptions }): Promise<void>;
|
|
|
|
textContent(): Promise<string | null>;
|
|
|
|
type(params: { text: string; options?: { delay?: number } & types.TimeoutOptions & { noWaitAfter?: boolean } }): Promise<void>;
|
|
|
|
uncheck(params: { options?: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
}
|
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface RequestChannel extends Channel {
|
2020-06-26 11:51:47 -07:00
|
|
|
response(): Promise<ResponseChannel | null>;
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type RequestInitializer = {
|
|
|
|
frame: FrameChannel,
|
|
|
|
url: string,
|
|
|
|
resourceType: string,
|
|
|
|
method: string,
|
|
|
|
postData: string | null,
|
|
|
|
headers: types.Headers,
|
|
|
|
isNavigationRequest: boolean,
|
|
|
|
redirectedFrom: RequestChannel | null,
|
|
|
|
};
|
2020-06-26 11:51:47 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-26 11:51:47 -07:00
|
|
|
export interface RouteChannel extends Channel {
|
|
|
|
abort(params: { errorCode: string }): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
continue(params: { overrides: { method?: string, headers?: types.Headers, postData?: string } }): Promise<void>;
|
2020-06-29 16:37:38 -07:00
|
|
|
fulfill(params: {
|
|
|
|
response: {
|
|
|
|
status?: number,
|
|
|
|
headers?: types.Headers,
|
2020-07-03 18:04:08 -07:00
|
|
|
body: string,
|
|
|
|
isBase64: boolean,
|
2020-06-29 16:37:38 -07:00
|
|
|
}
|
|
|
|
}): Promise<void>;
|
2020-06-25 16:05:36 -07:00
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type RouteInitializer = {
|
|
|
|
request: RequestChannel,
|
|
|
|
};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-25 16:05:36 -07:00
|
|
|
export interface ResponseChannel extends Channel {
|
2020-06-29 18:58:09 -07:00
|
|
|
body(): Promise<Binary>;
|
2020-06-25 16:05:36 -07:00
|
|
|
finished(): Promise<Error | null>;
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type ResponseInitializer = {
|
|
|
|
request: RequestChannel,
|
|
|
|
url: string,
|
|
|
|
status: number,
|
|
|
|
statusText: string,
|
|
|
|
headers: types.Headers,
|
|
|
|
};
|
2020-06-25 16:05:36 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-25 18:01:18 -07:00
|
|
|
export interface ConsoleMessageChannel extends Channel {
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type ConsoleMessageInitializer = {
|
|
|
|
type: string,
|
|
|
|
text: string,
|
|
|
|
args: JSHandleChannel[],
|
|
|
|
location: types.ConsoleMessageLocation,
|
|
|
|
};
|
2020-06-26 11:51:47 -07:00
|
|
|
|
2020-06-26 17:24:21 -07:00
|
|
|
|
2020-06-26 11:51:47 -07:00
|
|
|
export interface BindingCallChannel extends Channel {
|
|
|
|
reject(params: { error: types.Error }): void;
|
|
|
|
resolve(params: { result: any }): void;
|
|
|
|
}
|
2020-06-26 12:28:27 -07:00
|
|
|
export type BindingCallInitializer = {
|
|
|
|
frame: FrameChannel,
|
|
|
|
name: string,
|
|
|
|
args: any[]
|
|
|
|
};
|
2020-06-26 17:24:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
export interface DialogChannel extends Channel {
|
|
|
|
accept(params: { promptText?: string }): Promise<void>;
|
|
|
|
dismiss(): Promise<void>;
|
|
|
|
}
|
|
|
|
export type DialogInitializer = {
|
|
|
|
type: string,
|
|
|
|
message: string,
|
|
|
|
defaultValue: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export interface DownloadChannel extends Channel {
|
2020-06-29 18:58:09 -07:00
|
|
|
path(): Promise<string | null>;
|
2020-06-26 17:24:21 -07:00
|
|
|
failure(): Promise<string | null>;
|
|
|
|
delete(): Promise<void>;
|
|
|
|
}
|
|
|
|
export type DownloadInitializer = {
|
|
|
|
url: string,
|
|
|
|
suggestedFilename: string,
|
|
|
|
};
|