chore(rpc): inline options parameter in all rpc channels (#2842)
This commit is contained in:
parent
8d111a8820
commit
6bbe7eb006
|
|
@ -24,10 +24,10 @@ export interface Channel extends EventEmitter {
|
|||
|
||||
|
||||
export interface BrowserTypeChannel extends Channel {
|
||||
connect(params: { options: types.ConnectOptions }): Promise<BrowserChannel>;
|
||||
launch(params: { options?: types.LaunchOptions }): Promise<BrowserChannel>;
|
||||
launchServer(params: { options?: types.LaunchServerOptions }): Promise<BrowserServerChannel>;
|
||||
launchPersistentContext(params: { userDataDir: string, options?: types.LaunchOptions & types.BrowserContextOptions }): Promise<BrowserContextChannel>;
|
||||
connect(params: types.ConnectOptions): Promise<BrowserChannel>;
|
||||
launch(params: types.LaunchOptions): Promise<BrowserChannel>;
|
||||
launchServer(params: types.LaunchServerOptions): Promise<BrowserServerChannel>;
|
||||
launchPersistentContext(params: { userDataDir: string } & types.LaunchOptions & types.BrowserContextOptions): Promise<BrowserContextChannel>;
|
||||
}
|
||||
export type BrowserTypeInitializer = {
|
||||
executablePath: string,
|
||||
|
|
@ -51,7 +51,7 @@ export interface BrowserChannel extends Channel {
|
|||
on(event: 'close', callback: () => void): this;
|
||||
|
||||
close(): Promise<void>;
|
||||
newContext(params: { options?: types.BrowserContextOptions }): Promise<BrowserContextChannel>;
|
||||
newContext(params: types.BrowserContextOptions): Promise<BrowserContextChannel>;
|
||||
}
|
||||
export type BrowserInitializer = {};
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ export interface BrowserContextChannel extends Channel {
|
|||
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>;
|
||||
grantPermissions(params: { permissions: string[], origin?: string }): Promise<void>;
|
||||
newPage(): Promise<PageChannel>;
|
||||
setDefaultNavigationTimeoutNoReply(params: { timeout: number }): void;
|
||||
setDefaultTimeoutNoReply(params: { timeout: number }): void;
|
||||
|
|
@ -113,14 +113,14 @@ export interface PageChannel extends Channel {
|
|||
setFileChooserInterceptedNoReply(params: { intercepted: boolean }): Promise<void>;
|
||||
|
||||
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>;
|
||||
close(params: { runBeforeUnload?: boolean }): Promise<void>;
|
||||
emulateMedia(params: { media?: 'screen' | 'print', colorScheme?: 'dark' | 'light' | 'no-preference' }): Promise<void>;
|
||||
exposeBinding(params: { name: string }): Promise<void>;
|
||||
goBack(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null>;
|
||||
goForward(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null>;
|
||||
goBack(params: types.NavigateOptions): Promise<ResponseChannel | null>;
|
||||
goForward(params: types.NavigateOptions): Promise<ResponseChannel | null>;
|
||||
opener(): Promise<PageChannel | null>;
|
||||
reload(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null>;
|
||||
screenshot(params: { options?: types.ScreenshotOptions }): Promise<Binary>;
|
||||
reload(params: types.NavigateOptions): Promise<ResponseChannel | null>;
|
||||
screenshot(params: types.ScreenshotOptions): Promise<Binary>;
|
||||
setExtraHTTPHeaders(params: { headers: types.Headers }): Promise<void>;
|
||||
setNetworkInterceptionEnabled(params: { enabled: boolean }): Promise<void>;
|
||||
setViewportSize(params: { viewportSize: types.Size }): Promise<void>;
|
||||
|
|
@ -129,16 +129,16 @@ export interface PageChannel extends Channel {
|
|||
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>;
|
||||
keyboardType(params: { text: string, delay?: number }): Promise<void>;
|
||||
keyboardPress(params: { key: string, delay?: number }): Promise<void>;
|
||||
mouseMove(params: { x: number, y: number, steps?: number }): Promise<void>;
|
||||
mouseDown(params: { button?: types.MouseButton, clickCount?: number }): Promise<void>;
|
||||
mouseUp(params: { button?: types.MouseButton, clickCount?: number }): Promise<void>;
|
||||
mouseClick(params: { x: number, y: number, delay?: number, button?: types.MouseButton, clickCount?: number }): Promise<void>;
|
||||
|
||||
// A11Y
|
||||
accessibilitySnapshot(params: { options: { interestingOnly?: boolean, root?: ElementHandleChannel } }): Promise<types.SerializedAXNode | null>;
|
||||
pdf: (params: { options?: types.PDFOptions }) => Promise<Binary>;
|
||||
accessibilitySnapshot(params: { interestingOnly?: boolean, root?: ElementHandleChannel }): Promise<types.SerializedAXNode | null>;
|
||||
pdf: (params: types.PDFOptions) => Promise<Binary>;
|
||||
}
|
||||
|
||||
export type PageInitializer = {
|
||||
|
|
@ -146,41 +146,42 @@ export type PageInitializer = {
|
|||
viewportSize: types.Size | null
|
||||
};
|
||||
|
||||
export type PageAttribution = { isPage?: boolean };
|
||||
|
||||
export interface FrameChannel extends Channel {
|
||||
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>;
|
||||
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>;
|
||||
evalOnSelector(params: { selector: string; expression: string, isFunction: boolean, arg: any} & PageAttribution): Promise<any>;
|
||||
evalOnSelectorAll(params: { selector: string; expression: string, isFunction: boolean, arg: any} & PageAttribution): Promise<any>;
|
||||
addScriptTag(params: { url?: string | undefined, path?: string | undefined, content?: string | undefined, type?: string | undefined} & PageAttribution): Promise<ElementHandleChannel>;
|
||||
addStyleTag(params: { url?: string | undefined, path?: string | undefined, content?: string | undefined} & PageAttribution): Promise<ElementHandleChannel>;
|
||||
check(params: { selector: string, force?: boolean, noWaitAfter?: boolean } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
click(params: { selector: string, force?: boolean, noWaitAfter?: boolean } & types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
content(): Promise<string>;
|
||||
dblclick(params: { selector: string, options: types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & { force?: boolean }, isPage?: boolean}): Promise<void>;
|
||||
dispatchEvent(params: { selector: string, type: string, eventInit: any, options: types.TimeoutOptions, isPage?: boolean }): Promise<void>;
|
||||
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>;
|
||||
dblclick(params: { selector: string, force?: boolean } & types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
dispatchEvent(params: { selector: string, type: string, eventInit: any } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
evaluateExpression(params: { expression: string, isFunction: boolean, arg: any} & PageAttribution): Promise<any>;
|
||||
evaluateExpressionHandle(params: { expression: string, isFunction: boolean, arg: any} & PageAttribution): Promise<JSHandleChannel>;
|
||||
fill(params: { selector: string, value: string } & types.NavigatingActionWaitOptions & PageAttribution): Promise<void>;
|
||||
focus(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
frameElement(): Promise<ElementHandleChannel>;
|
||||
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>;
|
||||
getAttribute(params: { selector: string, name: string } & types.TimeoutOptions & PageAttribution): Promise<string | null>;
|
||||
goto(params: { url: string } & types.GotoOptions & PageAttribution): Promise<ResponseChannel | null>;
|
||||
hover(params: { selector: string, force?: boolean } & types.PointerActionOptions & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
innerHTML(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<string>;
|
||||
innerText(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<string>;
|
||||
press(params: { selector: string, key: string, delay?: number, noWaitAfter?: boolean } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
querySelector(params: { selector: string} & PageAttribution): Promise<ElementHandleChannel | null>;
|
||||
querySelectorAll(params: { selector: string} & PageAttribution): Promise<ElementHandleChannel[]>;
|
||||
selectOption(params: { selector: string, values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null } & types.NavigatingActionWaitOptions & PageAttribution): Promise<string[]>;
|
||||
setContent(params: { html: string } & types.NavigateOptions & PageAttribution): Promise<void>;
|
||||
setInputFiles(params: { selector: string, files: { name: string, mimeType: string, buffer: string }[] } & types.NavigatingActionWaitOptions & PageAttribution): Promise<void>;
|
||||
textContent(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<string | null>;
|
||||
title(): Promise<string>;
|
||||
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>;
|
||||
type(params: { selector: string, text: string, delay?: number, noWaitAfter?: boolean } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
uncheck(params: { selector: string, force?: boolean, noWaitAfter?: boolean } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
waitForFunction(params: { expression: string, isFunction: boolean, arg: any } & types.WaitForFunctionOptions & PageAttribution): Promise<JSHandleChannel>;
|
||||
waitForLoadState(params: { state: types.LifecycleEvent } & types.TimeoutOptions & PageAttribution): Promise<void>;
|
||||
waitForNavigation(params: types.WaitForNavigationOptions & PageAttribution): Promise<ResponseChannel | null>;
|
||||
waitForSelector(params: { selector: string } & types.WaitForElementOptions & PageAttribution): Promise<ElementHandleChannel | null>;
|
||||
}
|
||||
export type FrameInitializer = {
|
||||
url: string,
|
||||
|
|
@ -217,29 +218,29 @@ export interface ElementHandleChannel extends JSHandleChannel {
|
|||
evalOnSelector(params: { selector: string; expression: string, isFunction: boolean, arg: any }): Promise<any>;
|
||||
evalOnSelectorAll(params: { selector: string; expression: string, isFunction: boolean, arg: any }): Promise<any>;
|
||||
boundingBox(): Promise<types.Rect | null>;
|
||||
check(params: { options?: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
||||
click(params: { options?: types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
||||
check(params: { force?: boolean } & { noWaitAfter?: boolean } & types.TimeoutOptions): Promise<void>;
|
||||
click(params: { force?: boolean, noWaitAfter?: boolean } & types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions): Promise<void>;
|
||||
contentFrame(): Promise<FrameChannel | null>;
|
||||
dblclick(params: { options?: types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } }): Promise<void>;
|
||||
dblclick(params: { force?: boolean, noWaitAfter?: boolean } & types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions): Promise<void>;
|
||||
dispatchEvent(params: { type: string, eventInit: any }): Promise<void>;
|
||||
fill(params: { value: string; options?: types.NavigatingActionWaitOptions }): Promise<void>;
|
||||
fill(params: { value: string } & types.NavigatingActionWaitOptions): Promise<void>;
|
||||
focus(): Promise<void>;
|
||||
getAttribute(params: { name: string }): Promise<string | null>;
|
||||
hover(params: { options?: types.PointerActionOptions & types.TimeoutOptions & { force?: boolean } }): Promise<void>;
|
||||
hover(params: { force?: boolean } & types.PointerActionOptions & types.TimeoutOptions): Promise<void>;
|
||||
innerHTML(): Promise<string>;
|
||||
innerText(): Promise<string>;
|
||||
ownerFrame(): Promise<FrameChannel | null>;
|
||||
press(params: { key: string; options?: { delay?: number } & types.TimeoutOptions & { noWaitAfter?: boolean } }): Promise<void>;
|
||||
press(params: { key: string, delay?: number } & types.TimeoutOptions & { noWaitAfter?: boolean }): Promise<void>;
|
||||
querySelector(params: { selector: string }): Promise<ElementHandleChannel | null>;
|
||||
querySelectorAll(params: { selector: string }): Promise<ElementHandleChannel[]>;
|
||||
screenshot(params: { options?: types.ElementScreenshotOptions }): Promise<Binary>;
|
||||
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>;
|
||||
screenshot(params: types.ElementScreenshotOptions): Promise<Binary>;
|
||||
scrollIntoViewIfNeeded(params: types.TimeoutOptions): Promise<void>;
|
||||
selectOption(params: { values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null } & types.NavigatingActionWaitOptions): string[] | Promise<string[]>;
|
||||
selectText(params: types.TimeoutOptions): Promise<void>;
|
||||
setInputFiles(params: { files: string | string[] | types.FilePayload | types.FilePayload[] } & 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>;
|
||||
type(params: { text: string, delay?: number, noWaitAfter?: boolean } & types.TimeoutOptions): Promise<void>;
|
||||
uncheck(params: { force?: boolean, noWaitAfter?: boolean } & types.TimeoutOptions): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ export class Accessibility {
|
|||
|
||||
snapshot(options: { interestingOnly?: boolean; root?: ElementHandle } = {}): Promise<types.SerializedAXNode | null> {
|
||||
const root = options.root ? options.root._elementChannel : undefined;
|
||||
return this._channel.accessibilitySnapshot({ options: { interestingOnly: options.interestingOnly, root } });
|
||||
return this._channel.accessibilitySnapshot({ interestingOnly: options.interestingOnly, root });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export class Browser extends ChannelOwner<BrowserChannel, BrowserInitializer> {
|
|||
|
||||
async newContext(options: types.BrowserContextOptions = {}): Promise<BrowserContext> {
|
||||
delete (options as any).logger;
|
||||
const context = BrowserContext.from(await this._channel.newContext({ options }));
|
||||
const context = BrowserContext.from(await this._channel.newContext(options));
|
||||
this._contexts.add(context);
|
||||
context._browser = this;
|
||||
return context;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export class BrowserContext extends ChannelOwner<BrowserContextChannel, BrowserC
|
|||
}
|
||||
|
||||
async grantPermissions(permissions: string[], options?: { origin?: string }): Promise<void> {
|
||||
await this._channel.grantPermissions({ permissions, options });
|
||||
await this._channel.grantPermissions({ permissions, ...options });
|
||||
}
|
||||
|
||||
async clearPermissions(): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -37,21 +37,21 @@ export class BrowserType extends ChannelOwner<BrowserTypeChannel, BrowserTypeIni
|
|||
|
||||
async launch(options: types.LaunchOptions = {}): Promise<Browser> {
|
||||
delete (options as any).logger;
|
||||
return Browser.from(await this._channel.launch({ options }));
|
||||
return Browser.from(await this._channel.launch(options));
|
||||
}
|
||||
|
||||
async launchServer(options?: types.LaunchServerOptions): Promise<BrowserServer> {
|
||||
async launchServer(options: types.LaunchServerOptions = {}): Promise<BrowserServer> {
|
||||
delete (options as any).logger;
|
||||
return BrowserServer.from(await this._channel.launchServer({ options }));
|
||||
return BrowserServer.from(await this._channel.launchServer(options));
|
||||
}
|
||||
|
||||
async launchPersistentContext(userDataDir: string, options: types.LaunchOptions & types.BrowserContextOptions = {}): Promise<BrowserContext> {
|
||||
delete (options as any).logger;
|
||||
return BrowserContext.from(await this._channel.launchPersistentContext({ userDataDir, options }));
|
||||
return BrowserContext.from(await this._channel.launchPersistentContext({ userDataDir, ...options }));
|
||||
}
|
||||
|
||||
async connect(options: types.ConnectOptions): Promise<Browser> {
|
||||
delete (options as any).logger;
|
||||
return Browser.from(await this._channel.connect({ options }));
|
||||
return Browser.from(await this._channel.connect(options));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,36 +68,36 @@ export class ElementHandle<T extends Node = Node> extends JSHandle<T> {
|
|||
await this._elementChannel.dispatchEvent({ type, eventInit });
|
||||
}
|
||||
|
||||
async scrollIntoViewIfNeeded(options?: types.TimeoutOptions) {
|
||||
await this._elementChannel.scrollIntoViewIfNeeded({ options });
|
||||
async scrollIntoViewIfNeeded(options: types.TimeoutOptions = {}) {
|
||||
await this._elementChannel.scrollIntoViewIfNeeded(options);
|
||||
}
|
||||
|
||||
async hover(options: types.PointerActionOptions & types.PointerActionWaitOptions = {}): Promise<void> {
|
||||
await this._elementChannel.hover({ options });
|
||||
await this._elementChannel.hover(options);
|
||||
}
|
||||
|
||||
async click(options: types.MouseClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}): Promise<void> {
|
||||
return await this._elementChannel.click({ options });
|
||||
return await this._elementChannel.click(options);
|
||||
}
|
||||
|
||||
async dblclick(options: types.MouseMultiClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}): Promise<void> {
|
||||
return await this._elementChannel.dblclick({ options });
|
||||
return await this._elementChannel.dblclick(options);
|
||||
}
|
||||
|
||||
async selectOption(values: string | ElementHandle | types.SelectOption | string[] | ElementHandle[] | types.SelectOption[] | null, options: types.NavigatingActionWaitOptions = {}): Promise<string[]> {
|
||||
return await this._elementChannel.selectOption({ values: convertSelectOptionValues(values), options });
|
||||
return await this._elementChannel.selectOption({ values: convertSelectOptionValues(values), ...options });
|
||||
}
|
||||
|
||||
async fill(value: string, options: types.NavigatingActionWaitOptions = {}): Promise<void> {
|
||||
return await this._elementChannel.fill({ value, options });
|
||||
return await this._elementChannel.fill({ value, ...options });
|
||||
}
|
||||
|
||||
async selectText(options: types.TimeoutOptions): Promise<void> {
|
||||
await this._elementChannel.selectText({ options });
|
||||
await this._elementChannel.selectText(options);
|
||||
}
|
||||
|
||||
async setInputFiles(files: string | types.FilePayload | string[] | types.FilePayload[], options: types.NavigatingActionWaitOptions = {}) {
|
||||
await this._elementChannel.setInputFiles({ files, options });
|
||||
await this._elementChannel.setInputFiles({ files, ...options });
|
||||
}
|
||||
|
||||
async focus(): Promise<void> {
|
||||
|
|
@ -105,27 +105,27 @@ export class ElementHandle<T extends Node = Node> extends JSHandle<T> {
|
|||
}
|
||||
|
||||
async type(text: string, options: { delay?: number } & types.NavigatingActionWaitOptions = {}): Promise<void> {
|
||||
await this._elementChannel.type({ text, options });
|
||||
await this._elementChannel.type({ text, ...options });
|
||||
}
|
||||
|
||||
async press(key: string, options: { delay?: number } & types.NavigatingActionWaitOptions = {}): Promise<void> {
|
||||
await this._elementChannel.press({ key, options });
|
||||
await this._elementChannel.press({ key, ...options });
|
||||
}
|
||||
|
||||
async check(options: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}) {
|
||||
return await this._elementChannel.check({ options });
|
||||
return await this._elementChannel.check(options);
|
||||
}
|
||||
|
||||
async uncheck(options: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}) {
|
||||
return await this._elementChannel.uncheck({ options });
|
||||
return await this._elementChannel.uncheck(options);
|
||||
}
|
||||
|
||||
async boundingBox(): Promise<types.Rect | null> {
|
||||
return await this._elementChannel.boundingBox();
|
||||
}
|
||||
|
||||
async screenshot(options?: types.ElementScreenshotOptions): Promise<Buffer> {
|
||||
return Buffer.from(await this._elementChannel.screenshot({ options }), 'base64');
|
||||
async screenshot(options: types.ElementScreenshotOptions = {}): Promise<Buffer> {
|
||||
return Buffer.from(await this._elementChannel.screenshot(options), 'base64');
|
||||
}
|
||||
|
||||
async $(selector: string): Promise<ElementHandle<Element> | null> {
|
||||
|
|
|
|||
|
|
@ -60,15 +60,15 @@ export class Frame extends ChannelOwner<FrameChannel, FrameInitializer> {
|
|||
}
|
||||
|
||||
async goto(url: string, options: GotoOptions = {}): Promise<network.Response | null> {
|
||||
return Response.fromNullable(await this._channel.goto({ url, options, isPage: this._page!._isPageCall }));
|
||||
return Response.fromNullable(await this._channel.goto({ url, ...options, isPage: this._page!._isPageCall }));
|
||||
}
|
||||
|
||||
async waitForNavigation(options: types.WaitForNavigationOptions = {}): Promise<network.Response | null> {
|
||||
return Response.fromNullable(await this._channel.waitForNavigation({ options, isPage: this._page!._isPageCall }));
|
||||
return Response.fromNullable(await this._channel.waitForNavigation({ ...options, isPage: this._page!._isPageCall }));
|
||||
}
|
||||
|
||||
async waitForLoadState(state: types.LifecycleEvent = 'load', options: types.TimeoutOptions = {}): Promise<void> {
|
||||
await this._channel.waitForLoadState({ state, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.waitForLoadState({ state, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async frameElement(): Promise<ElementHandle> {
|
||||
|
|
@ -94,11 +94,11 @@ export class Frame extends ChannelOwner<FrameChannel, FrameInitializer> {
|
|||
}
|
||||
|
||||
async waitForSelector(selector: string, options: types.WaitForElementOptions = {}): Promise<ElementHandle<Element> | null> {
|
||||
return ElementHandle.fromNullable(await this._channel.waitForSelector({ selector, options, isPage: this._page!._isPageCall })) as ElementHandle<Element> | null;
|
||||
return ElementHandle.fromNullable(await this._channel.waitForSelector({ selector, ...options, isPage: this._page!._isPageCall })) as ElementHandle<Element> | null;
|
||||
}
|
||||
|
||||
async dispatchEvent(selector: string, type: string, eventInit?: any, options: types.TimeoutOptions = {}): Promise<void> {
|
||||
await this._channel.dispatchEvent({ selector, type, eventInit: serializeArgument(eventInit), options, isPage: this._page!._isPageCall });
|
||||
await this._channel.dispatchEvent({ selector, type, eventInit: serializeArgument(eventInit), ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async $eval<R, Arg>(selector: string, pageFunction: FuncOn<Element, Arg, R>, arg: Arg): Promise<R>;
|
||||
|
|
@ -125,7 +125,7 @@ export class Frame extends ChannelOwner<FrameChannel, FrameInitializer> {
|
|||
}
|
||||
|
||||
async setContent(html: string, options: types.NavigateOptions = {}): Promise<void> {
|
||||
await this._channel.setContent({ html, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.setContent({ html, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
name(): string {
|
||||
|
|
@ -149,72 +149,72 @@ export class Frame extends ChannelOwner<FrameChannel, FrameInitializer> {
|
|||
}
|
||||
|
||||
async addScriptTag(options: { url?: string, path?: string, content?: string, type?: string }): Promise<ElementHandle> {
|
||||
return ElementHandle.from(await this._channel.addScriptTag({ options, isPage: this._page!._isPageCall }));
|
||||
return ElementHandle.from(await this._channel.addScriptTag({ ...options, isPage: this._page!._isPageCall }));
|
||||
}
|
||||
|
||||
async addStyleTag(options: { url?: string; path?: string; content?: string; }): Promise<ElementHandle> {
|
||||
return ElementHandle.from(await this._channel.addStyleTag({ options, isPage: this._page!._isPageCall }));
|
||||
return ElementHandle.from(await this._channel.addStyleTag({ ...options, isPage: this._page!._isPageCall }));
|
||||
}
|
||||
|
||||
async click(selector: string, options: types.MouseClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}) {
|
||||
return await this._channel.click({ selector, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.click({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async dblclick(selector: string, options: types.MouseMultiClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}) {
|
||||
return await this._channel.dblclick({ selector, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.dblclick({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async fill(selector: string, value: string, options: types.NavigatingActionWaitOptions = {}) {
|
||||
return await this._channel.fill({ selector, value, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.fill({ selector, value, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async focus(selector: string, options: types.TimeoutOptions = {}) {
|
||||
await this._channel.focus({ selector, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.focus({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async textContent(selector: string, options: types.TimeoutOptions = {}): Promise<null|string> {
|
||||
return await this._channel.textContent({ selector, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.textContent({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async innerText(selector: string, options: types.TimeoutOptions = {}): Promise<string> {
|
||||
return await this._channel.innerText({ selector, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.innerText({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async innerHTML(selector: string, options: types.TimeoutOptions = {}): Promise<string> {
|
||||
return await this._channel.innerHTML({ selector, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.innerHTML({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async getAttribute(selector: string, name: string, options: types.TimeoutOptions = {}): Promise<string | null> {
|
||||
return await this._channel.getAttribute({ selector, name, options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.getAttribute({ selector, name, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async hover(selector: string, options: types.PointerActionOptions & types.PointerActionWaitOptions = {}) {
|
||||
await this._channel.hover({ selector, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.hover({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async selectOption(selector: string, values: string | ElementHandle | types.SelectOption | string[] | ElementHandle[] | types.SelectOption[] | null, options: types.NavigatingActionWaitOptions = {}): Promise<string[]> {
|
||||
return await this._channel.selectOption({ selector, values: convertSelectOptionValues(values), options, isPage: this._page!._isPageCall });
|
||||
return await this._channel.selectOption({ selector, values: convertSelectOptionValues(values), ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async setInputFiles(selector: string, files: string | types.FilePayload | string[] | types.FilePayload[], options: types.NavigatingActionWaitOptions = {}): Promise<void> {
|
||||
const filePayloads = await normalizeFilePayloads(files);
|
||||
await this._channel.setInputFiles({ selector, files: filePayloads.map(f => ({ name: f.name, mimeType: f.mimeType, buffer: f.buffer.toString('base64') })), options, isPage: this._page!._isPageCall });
|
||||
await this._channel.setInputFiles({ selector, files: filePayloads.map(f => ({ name: f.name, mimeType: f.mimeType, buffer: f.buffer.toString('base64') })), ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async type(selector: string, text: string, options: { delay?: number } & types.NavigatingActionWaitOptions = {}) {
|
||||
await this._channel.type({ selector, text, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.type({ selector, text, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async press(selector: string, key: string, options: { delay?: number } & types.NavigatingActionWaitOptions = {}) {
|
||||
await this._channel.press({ selector, key, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.press({ selector, key, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async check(selector: string, options: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}) {
|
||||
await this._channel.check({ selector, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.check({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async uncheck(selector: string, options: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions = {}) {
|
||||
await this._channel.uncheck({ selector, options, isPage: this._page!._isPageCall });
|
||||
await this._channel.uncheck({ selector, ...options, isPage: this._page!._isPageCall });
|
||||
}
|
||||
|
||||
async waitForTimeout(timeout: number) {
|
||||
|
|
@ -224,7 +224,7 @@ export class Frame extends ChannelOwner<FrameChannel, FrameInitializer> {
|
|||
async waitForFunction<R, Arg>(pageFunction: Func1<Arg, R>, arg: Arg, options?: types.WaitForFunctionOptions): Promise<SmartHandle<R>>;
|
||||
async waitForFunction<R>(pageFunction: Func1<void, R>, arg?: any, options?: types.WaitForFunctionOptions): Promise<SmartHandle<R>>;
|
||||
async waitForFunction<R, Arg>(pageFunction: Func1<Arg, R>, arg: Arg, options: types.WaitForFunctionOptions = {}): Promise<SmartHandle<R>> {
|
||||
return JSHandle.from(await this._channel.waitForFunction({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg), options, isPage: this._page!._isPageCall })) as SmartHandle<R>;
|
||||
return JSHandle.from(await this._channel.waitForFunction({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg), ...options, isPage: this._page!._isPageCall })) as SmartHandle<R>;
|
||||
}
|
||||
|
||||
async title(): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ export class Keyboard {
|
|||
}
|
||||
|
||||
async type(text: string, options: { delay?: number } = {}) {
|
||||
await this._channel.keyboardType({ text, options });
|
||||
await this._channel.keyboardType({ text, ...options });
|
||||
}
|
||||
|
||||
async press(key: string, options: { delay?: number } = {}) {
|
||||
await this._channel.keyboardPress({ key, options });
|
||||
await this._channel.keyboardPress({ key, ...options });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,19 +54,19 @@ export class Mouse {
|
|||
}
|
||||
|
||||
async move(x: number, y: number, options: { steps?: number } = {}) {
|
||||
await this._channel.mouseMove({ x, y, options });
|
||||
await this._channel.mouseMove({ x, y, ...options });
|
||||
}
|
||||
|
||||
async down(options: { button?: types.MouseButton, clickCount?: number } = {}) {
|
||||
await this._channel.mouseDown({ options });
|
||||
await this._channel.mouseDown({ ...options });
|
||||
}
|
||||
|
||||
async up(options: { button?: types.MouseButton, clickCount?: number } = {}) {
|
||||
await this._channel.mouseUp({ options });
|
||||
await this._channel.mouseUp(options);
|
||||
}
|
||||
|
||||
async click(x: number, y: number, options: { delay?: number, button?: types.MouseButton, clickCount?: number } = {}) {
|
||||
await this._channel.mouseClick({ x, y, options });
|
||||
await this._channel.mouseClick({ x, y, ...options });
|
||||
}
|
||||
|
||||
async dblclick(x: number, y: number, options: { delay?: number, button?: types.MouseButton } = {}) {
|
||||
|
|
|
|||
|
|
@ -303,8 +303,8 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
|
|||
return this._attributeToPage(() => this._mainFrame.goto(url, options));
|
||||
}
|
||||
|
||||
async reload(options?: types.NavigateOptions): Promise<Response | null> {
|
||||
return Response.fromNullable(await this._channel.reload({ options }));
|
||||
async reload(options: types.NavigateOptions = {}): Promise<Response | null> {
|
||||
return Response.fromNullable(await this._channel.reload(options));
|
||||
}
|
||||
|
||||
async waitForLoadState(state?: types.LifecycleEvent, options?: types.TimeoutOptions): Promise<void> {
|
||||
|
|
@ -343,16 +343,16 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
|
|||
return result;
|
||||
}
|
||||
|
||||
async goBack(options?: types.NavigateOptions): Promise<Response | null> {
|
||||
return Response.fromNullable(await this._channel.goBack({ options }));
|
||||
async goBack(options: types.NavigateOptions = {}): Promise<Response | null> {
|
||||
return Response.fromNullable(await this._channel.goBack(options));
|
||||
}
|
||||
|
||||
async goForward(options?: types.NavigateOptions): Promise<Response | null> {
|
||||
return Response.fromNullable(await this._channel.goForward({ options }));
|
||||
async goForward(options: types.NavigateOptions = {}): Promise<Response | null> {
|
||||
return Response.fromNullable(await this._channel.goForward(options));
|
||||
}
|
||||
|
||||
async emulateMedia(options: { media?: types.MediaType, colorScheme?: types.ColorScheme }) {
|
||||
await this._channel.emulateMedia({ options });
|
||||
await this._channel.emulateMedia(options);
|
||||
}
|
||||
|
||||
async setViewportSize(viewportSize: types.Size) {
|
||||
|
|
@ -388,8 +388,8 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
|
|||
await this._channel.setNetworkInterceptionEnabled({ enabled: false });
|
||||
}
|
||||
|
||||
async screenshot(options?: types.ScreenshotOptions): Promise<Buffer> {
|
||||
return Buffer.from(await this._channel.screenshot({ options }), 'base64');
|
||||
async screenshot(options: types.ScreenshotOptions = {}): Promise<Buffer> {
|
||||
return Buffer.from(await this._channel.screenshot(options), 'base64');
|
||||
}
|
||||
|
||||
async title(): Promise<string> {
|
||||
|
|
@ -397,7 +397,7 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
|
|||
}
|
||||
|
||||
async close(options: { runBeforeUnload?: boolean } = {runBeforeUnload: undefined}) {
|
||||
await this._channel.close({ options });
|
||||
await this._channel.close(options);
|
||||
if (this._ownedContext)
|
||||
await this._ownedContext.close();
|
||||
}
|
||||
|
|
@ -496,8 +496,8 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
|
|||
return this;
|
||||
}
|
||||
|
||||
async pdf(options?: types.PDFOptions): Promise<Buffer> {
|
||||
const binary = await this._channel.pdf({ options });
|
||||
async pdf(options: types.PDFOptions = {}): Promise<Buffer> {
|
||||
const binary = await this._channel.pdf(options);
|
||||
return Buffer.from(binary, 'base64');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ export class BrowserDispatcher extends Dispatcher<Browser, BrowserInitializer> i
|
|||
});
|
||||
}
|
||||
|
||||
async newContext(params: { options?: types.BrowserContextOptions }): Promise<BrowserContextChannel> {
|
||||
return new BrowserContextDispatcher(this._scope, await this._object.newContext(params.options) as BrowserContextBase);
|
||||
async newContext(params: types.BrowserContextOptions): Promise<BrowserContextChannel> {
|
||||
return new BrowserContextDispatcher(this._scope, await this._object.newContext(params) as BrowserContextBase);
|
||||
}
|
||||
|
||||
async close(): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -32,22 +32,22 @@ export class BrowserTypeDispatcher extends Dispatcher<BrowserType, BrowserTypeIn
|
|||
}, false, browserType.name());
|
||||
}
|
||||
|
||||
async launch(params: { options?: types.LaunchOptions }): Promise<BrowserChannel> {
|
||||
const browser = await this._object.launch(params.options || undefined);
|
||||
async launch(params: types.LaunchOptions): Promise<BrowserChannel> {
|
||||
const browser = await this._object.launch(params);
|
||||
return new BrowserDispatcher(this._scope, browser as BrowserBase);
|
||||
}
|
||||
|
||||
async launchPersistentContext(params: { userDataDir: string, options?: types.LaunchOptions & types.BrowserContextOptions }): Promise<BrowserContextChannel> {
|
||||
const browserContext = await this._object.launchPersistentContext(params.userDataDir, params.options);
|
||||
async launchPersistentContext(params: { userDataDir: string } & types.LaunchOptions & types.BrowserContextOptions): Promise<BrowserContextChannel> {
|
||||
const browserContext = await this._object.launchPersistentContext(params.userDataDir, params);
|
||||
return new BrowserContextDispatcher(this._scope, browserContext as BrowserContextBase);
|
||||
}
|
||||
|
||||
async launchServer(params: { options?: types.LaunchServerOptions }): Promise<BrowserServerChannel> {
|
||||
return new BrowserServerDispatcher(this._scope, await this._object.launchServer(params.options));
|
||||
async launchServer(params: types.LaunchServerOptions): Promise<BrowserServerChannel> {
|
||||
return new BrowserServerDispatcher(this._scope, await this._object.launchServer(params));
|
||||
}
|
||||
|
||||
async connect(params: { options: types.ConnectOptions }): Promise<BrowserChannel> {
|
||||
const browser = await this._object.connect(params.options);
|
||||
async connect(params: types.ConnectOptions): Promise<BrowserChannel> {
|
||||
const browser = await this._object.connect(params);
|
||||
return new BrowserDispatcher(this._scope, browser as BrowserBase);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,64 +69,64 @@ export class ElementHandleDispatcher extends JSHandleDispatcher implements Eleme
|
|||
await this._elementHandle.dispatchEvent(params.type, params.eventInit);
|
||||
}
|
||||
|
||||
async scrollIntoViewIfNeeded(params: { options?: types.TimeoutOptions }) {
|
||||
await this._elementHandle.scrollIntoViewIfNeeded(params.options);
|
||||
async scrollIntoViewIfNeeded(params: types.TimeoutOptions) {
|
||||
await this._elementHandle.scrollIntoViewIfNeeded(params);
|
||||
}
|
||||
|
||||
async hover(params: { options?: types.PointerActionOptions & types.PointerActionWaitOptions }) {
|
||||
await this._elementHandle.hover(params.options);
|
||||
async hover(params: types.PointerActionOptions & types.PointerActionWaitOptions) {
|
||||
await this._elementHandle.hover(params);
|
||||
}
|
||||
|
||||
async click(params: { options?: types.MouseClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.click(params.options);
|
||||
async click(params: types.MouseClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.click(params);
|
||||
}
|
||||
|
||||
async dblclick(params: { options?: types.MouseMultiClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.dblclick(params.options);
|
||||
async dblclick(params: types.MouseMultiClickOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.dblclick(params);
|
||||
}
|
||||
|
||||
async selectOption(params: { values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null, options: types.NavigatingActionWaitOptions }): Promise<string[]> {
|
||||
return this._elementHandle.selectOption(convertSelectOptionValues(params.values), params.options);
|
||||
async selectOption(params: { values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null } & types.NavigatingActionWaitOptions): Promise<string[]> {
|
||||
return this._elementHandle.selectOption(convertSelectOptionValues(params.values), params);
|
||||
}
|
||||
|
||||
async fill(params: { value: string, options: types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.fill(params.value, params.options);
|
||||
async fill(params: { value: string } & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.fill(params.value, params);
|
||||
}
|
||||
|
||||
async selectText(params: { options?: types.TimeoutOptions }) {
|
||||
await this._elementHandle.selectText(params.options);
|
||||
async selectText(params: types.TimeoutOptions) {
|
||||
await this._elementHandle.selectText(params);
|
||||
}
|
||||
|
||||
async setInputFiles(params: { files: string | types.FilePayload | string[] | types.FilePayload[], options?: types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.setInputFiles(params.files, params.options);
|
||||
async setInputFiles(params: { files: string | types.FilePayload | string[] | types.FilePayload[] } & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.setInputFiles(params.files, params);
|
||||
}
|
||||
|
||||
async focus() {
|
||||
await this._elementHandle.focus();
|
||||
}
|
||||
|
||||
async type(params: { text: string, options: { delay?: number } & types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.type(params.text, params.options);
|
||||
async type(params: { text: string } & { delay?: number } & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.type(params.text, params);
|
||||
}
|
||||
|
||||
async press(params: { key: string, options: { delay?: number } & types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.press(params.key, params.options);
|
||||
async press(params: { key: string } & { delay?: number } & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.press(params.key, params);
|
||||
}
|
||||
|
||||
async check(params: { options?: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.check(params.options);
|
||||
async check(params: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.check(params);
|
||||
}
|
||||
|
||||
async uncheck(params: { options?: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions }) {
|
||||
await this._elementHandle.uncheck(params.options);
|
||||
async uncheck(params: types.PointerActionWaitOptions & types.NavigatingActionWaitOptions) {
|
||||
await this._elementHandle.uncheck(params);
|
||||
}
|
||||
|
||||
async boundingBox(): Promise<types.Rect | null> {
|
||||
return await this._elementHandle.boundingBox();
|
||||
}
|
||||
|
||||
async screenshot(params: { options?: types.ElementScreenshotOptions }): Promise<string> {
|
||||
return (await this._elementHandle.screenshot(params.options)).toString('base64');
|
||||
async screenshot(params: types.ElementScreenshotOptions): Promise<string> {
|
||||
return (await this._elementHandle.screenshot(params)).toString('base64');
|
||||
}
|
||||
|
||||
async querySelector(params: { selector: string }): Promise<ElementHandleChannel | null> {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import { Frame } from '../../frames';
|
||||
import * as types from '../../types';
|
||||
import { ElementHandleChannel, FrameChannel, FrameInitializer, JSHandleChannel, ResponseChannel } from '../channels';
|
||||
import { ElementHandleChannel, FrameChannel, FrameInitializer, JSHandleChannel, ResponseChannel, PageAttribution } from '../channels';
|
||||
import { Dispatcher, DispatcherScope, lookupNullableDispatcher, existingDispatcher } from './dispatcher';
|
||||
import { convertSelectOptionValues, ElementHandleDispatcher, createHandle } from './elementHandlerDispatcher';
|
||||
import { parseArgument, serializeResult } from './jsHandleDispatcher';
|
||||
|
|
@ -39,61 +39,61 @@ export class FrameDispatcher extends Dispatcher<Frame, FrameInitializer> impleme
|
|||
this._frame = frame;
|
||||
}
|
||||
|
||||
async goto(params: { url: string, options: types.GotoOptions, isPage?: boolean }): Promise<ResponseChannel | null> {
|
||||
async goto(params: { url: string } & types.GotoOptions & PageAttribution): Promise<ResponseChannel | null> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await target.goto(params.url, params.options));
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await target.goto(params.url, params));
|
||||
}
|
||||
|
||||
async waitForLoadState(params: { state?: 'load' | 'domcontentloaded' | 'networkidle', options?: types.TimeoutOptions, isPage?: boolean }): Promise<void> {
|
||||
async waitForLoadState(params: { state?: 'load' | 'domcontentloaded' | 'networkidle' } & types.TimeoutOptions & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.waitForLoadState(params.state, params.options);
|
||||
await target.waitForLoadState(params.state, params);
|
||||
}
|
||||
|
||||
async waitForNavigation(params: { options?: types.WaitForNavigationOptions, isPage?: boolean }): Promise<ResponseChannel | null> {
|
||||
async waitForNavigation(params: types.WaitForNavigationOptions & PageAttribution): Promise<ResponseChannel | null> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await target.waitForNavigation(params.options));
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await target.waitForNavigation(params));
|
||||
}
|
||||
|
||||
async frameElement(): Promise<ElementHandleChannel> {
|
||||
return new ElementHandleDispatcher(this._scope, await this._frame.frameElement());
|
||||
}
|
||||
|
||||
async evaluateExpression(params: { expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<any> {
|
||||
async evaluateExpression(params: { expression: string, isFunction: boolean, arg: any } & PageAttribution): Promise<any> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return serializeResult(await target._evaluateExpression(params.expression, params.isFunction, parseArgument(params.arg)));
|
||||
}
|
||||
|
||||
async evaluateExpressionHandle(params: { expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<JSHandleChannel> {
|
||||
async evaluateExpressionHandle(params: { expression: string, isFunction: boolean, arg: any } & PageAttribution): Promise<JSHandleChannel> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return createHandle(this._scope, await target._evaluateExpressionHandle(params.expression, params.isFunction, parseArgument(params.arg)));
|
||||
}
|
||||
|
||||
async waitForSelector(params: { selector: string, options: types.WaitForElementOptions, isPage?: boolean }): Promise<ElementHandleChannel | null> {
|
||||
async waitForSelector(params: { selector: string } & types.WaitForElementOptions & PageAttribution): Promise<ElementHandleChannel | null> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return ElementHandleDispatcher.createNullable(this._scope, await target.waitForSelector(params.selector, params.options));
|
||||
return ElementHandleDispatcher.createNullable(this._scope, await target.waitForSelector(params.selector, params));
|
||||
}
|
||||
|
||||
async dispatchEvent(params: { selector: string, type: string, eventInit: any, options: types.TimeoutOptions, isPage?: boolean }): Promise<void> {
|
||||
async dispatchEvent(params: { selector: string, type: string, eventInit: any } & types.TimeoutOptions & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return target.dispatchEvent(params.selector, params.type, parseArgument(params.eventInit), params.options);
|
||||
return target.dispatchEvent(params.selector, params.type, parseArgument(params.eventInit), params);
|
||||
}
|
||||
|
||||
async evalOnSelector(params: { selector: string, expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<any> {
|
||||
async evalOnSelector(params: { selector: string, expression: string, isFunction: boolean, arg: any } & PageAttribution): Promise<any> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return serializeResult(await target._$evalExpression(params.selector, params.expression, params.isFunction, parseArgument(params.arg)));
|
||||
}
|
||||
|
||||
async evalOnSelectorAll(params: { selector: string, expression: string, isFunction: boolean, arg: any, isPage?: boolean }): Promise<any> {
|
||||
async evalOnSelectorAll(params: { selector: string, expression: string, isFunction: boolean, arg: any } & PageAttribution): Promise<any> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return serializeResult(await target._$$evalExpression(params.selector, params.expression, params.isFunction, parseArgument(params.arg)));
|
||||
}
|
||||
|
||||
async querySelector(params: { selector: string, isPage?: boolean }): Promise<ElementHandleChannel | null> {
|
||||
async querySelector(params: { selector: string } & PageAttribution): Promise<ElementHandleChannel | null> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return ElementHandleDispatcher.createNullable(this._scope, await target.$(params.selector));
|
||||
}
|
||||
|
||||
async querySelectorAll(params: { selector: string, isPage?: boolean }): Promise<ElementHandleChannel[]> {
|
||||
async querySelectorAll(params: { selector: string } & PageAttribution): Promise<ElementHandleChannel[]> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
const elements = await target.$$(params.selector);
|
||||
return elements.map(e => new ElementHandleDispatcher(this._scope, e));
|
||||
|
|
@ -103,99 +103,99 @@ export class FrameDispatcher extends Dispatcher<Frame, FrameInitializer> impleme
|
|||
return await this._frame.content();
|
||||
}
|
||||
|
||||
async setContent(params: { html: string, options: types.NavigateOptions, isPage?: boolean }): Promise<void> {
|
||||
async setContent(params: { html: string } & types.NavigateOptions & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.setContent(params.html, params.options);
|
||||
await target.setContent(params.html, params);
|
||||
}
|
||||
|
||||
async addScriptTag(params: { options: { url?: string | undefined, path?: string | undefined, content?: string | undefined, type?: string | undefined }, isPage?: boolean }): Promise<ElementHandleChannel> {
|
||||
async addScriptTag(params: { url?: string | undefined, path?: string | undefined, content?: string | undefined, type?: string | undefined } & PageAttribution): Promise<ElementHandleChannel> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return new ElementHandleDispatcher(this._scope, await target.addScriptTag(params.options));
|
||||
return new ElementHandleDispatcher(this._scope, await target.addScriptTag(params));
|
||||
}
|
||||
|
||||
async addStyleTag(params: { options: { url?: string | undefined, path?: string | undefined, content?: string | undefined }, isPage?: boolean }): Promise<ElementHandleChannel> {
|
||||
async addStyleTag(params: { url?: string | undefined, path?: string | undefined, content?: string | undefined } & PageAttribution): Promise<ElementHandleChannel> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return new ElementHandleDispatcher(this._scope, await target.addStyleTag(params.options));
|
||||
return new ElementHandleDispatcher(this._scope, await target.addStyleTag(params));
|
||||
}
|
||||
|
||||
async click(params: { selector: string, options: types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async click(params: { selector: string } & types.PointerActionOptions & types.MouseClickOptions & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.click(params.selector, params.options);
|
||||
await target.click(params.selector, params);
|
||||
}
|
||||
|
||||
async dblclick(params: { selector: string, options: types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & { force?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async dblclick(params: { selector: string } & types.PointerActionOptions & types.MouseMultiClickOptions & types.TimeoutOptions & { force?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.dblclick(params.selector, params.options);
|
||||
await target.dblclick(params.selector, params);
|
||||
}
|
||||
|
||||
async fill(params: { selector: string, value: string, options: types.NavigatingActionWaitOptions, isPage?: boolean }): Promise<void> {
|
||||
async fill(params: { selector: string, value: string } & types.NavigatingActionWaitOptions & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.fill(params.selector, params.value, params.options);
|
||||
await target.fill(params.selector, params.value, params);
|
||||
}
|
||||
|
||||
async focus(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<void> {
|
||||
async focus(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.focus(params.selector, params.options);
|
||||
await target.focus(params.selector, params);
|
||||
}
|
||||
|
||||
async textContent(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string | null> {
|
||||
async textContent(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<string | null> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return await target.textContent(params.selector, params.options);
|
||||
return await target.textContent(params.selector, params);
|
||||
}
|
||||
|
||||
async innerText(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string> {
|
||||
async innerText(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<string> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return await target.innerText(params.selector, params.options);
|
||||
return await target.innerText(params.selector, params);
|
||||
}
|
||||
|
||||
async innerHTML(params: { selector: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string> {
|
||||
async innerHTML(params: { selector: string } & types.TimeoutOptions & PageAttribution): Promise<string> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return await target.innerHTML(params.selector, params.options);
|
||||
return await target.innerHTML(params.selector, params);
|
||||
}
|
||||
|
||||
async getAttribute(params: { selector: string, name: string, options: types.TimeoutOptions, isPage?: boolean }): Promise<string | null> {
|
||||
async getAttribute(params: { selector: string, name: string } & types.TimeoutOptions & PageAttribution): Promise<string | null> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return await target.getAttribute(params.selector, params.name, params.options);
|
||||
return await target.getAttribute(params.selector, params.name, params);
|
||||
}
|
||||
|
||||
async hover(params: { selector: string, options: types.PointerActionOptions & types.TimeoutOptions & { force?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async hover(params: { selector: string } & types.PointerActionOptions & types.TimeoutOptions & { force?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.hover(params.selector, params.options);
|
||||
await target.hover(params.selector, params);
|
||||
}
|
||||
|
||||
async selectOption(params: { selector: string, values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null, options: types.NavigatingActionWaitOptions, isPage?: boolean }): Promise<string[]> {
|
||||
async selectOption(params: { selector: string, values: string | ElementHandleChannel | types.SelectOption | string[] | ElementHandleChannel[] | types.SelectOption[] | null } & types.NavigatingActionWaitOptions & PageAttribution): Promise<string[]> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return target.selectOption(params.selector, convertSelectOptionValues(params.values), params.options);
|
||||
return target.selectOption(params.selector, convertSelectOptionValues(params.values), params);
|
||||
}
|
||||
|
||||
async setInputFiles(params: { selector: string, files: { name: string, mimeType: string, buffer: string }[], options: types.NavigatingActionWaitOptions, isPage?: boolean }): Promise<void> {
|
||||
async setInputFiles(params: { selector: string, files: { name: string, mimeType: string, buffer: string }[] } & types.NavigatingActionWaitOptions & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.setInputFiles(params.selector, params.files.map(f => ({ name: f.name, mimeType: f.mimeType, buffer: Buffer.from(f.buffer, 'base64') })), params.options);
|
||||
await target.setInputFiles(params.selector, params.files.map(f => ({ name: f.name, mimeType: f.mimeType, buffer: Buffer.from(f.buffer, 'base64') })), params);
|
||||
}
|
||||
|
||||
async type(params: { selector: string, text: string, options: { delay?: number | undefined } & types.TimeoutOptions & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async type(params: { selector: string, text: string } & { delay?: number | undefined } & types.TimeoutOptions & { noWaitAfter?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.type(params.selector, params.text, params.options);
|
||||
await target.type(params.selector, params.text, params);
|
||||
}
|
||||
|
||||
async press(params: { selector: string, key: string, options: { delay?: number | undefined } & types.TimeoutOptions & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async press(params: { selector: string, key: string } & { delay?: number | undefined } & types.TimeoutOptions & { noWaitAfter?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.press(params.selector, params.key, params.options);
|
||||
await target.press(params.selector, params.key, params);
|
||||
}
|
||||
|
||||
async check(params: { selector: string, options: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async check(params: { selector: string } & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.check(params.selector, params.options);
|
||||
await target.check(params.selector, params);
|
||||
}
|
||||
|
||||
async uncheck(params: { selector: string, options: types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean }, isPage?: boolean }): Promise<void> {
|
||||
async uncheck(params: { selector: string } & types.TimeoutOptions & { force?: boolean } & { noWaitAfter?: boolean } & PageAttribution): Promise<void> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
await target.uncheck(params.selector, params.options);
|
||||
await target.uncheck(params.selector, params);
|
||||
}
|
||||
|
||||
async waitForFunction(params: { expression: string, isFunction: boolean, arg: any; options: types.WaitForFunctionOptions, isPage?: boolean }): Promise<JSHandleChannel> {
|
||||
async waitForFunction(params: { expression: string, isFunction: boolean, arg: any } & types.WaitForFunctionOptions & PageAttribution): Promise<JSHandleChannel> {
|
||||
const target = params.isPage ? this._frame._page : this._frame;
|
||||
return createHandle(this._scope, await target._waitForFunctionExpression(params.expression, params.isFunction, parseArgument(params.arg), params.options));
|
||||
return createHandle(this._scope, await target._waitForFunctionExpression(params.expression, params.isFunction, parseArgument(params.arg), params));
|
||||
}
|
||||
|
||||
async title(): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -91,20 +91,20 @@ export class PageDispatcher extends Dispatcher<Page, PageInitializer> implements
|
|||
await this._page.setExtraHTTPHeaders(params.headers);
|
||||
}
|
||||
|
||||
async reload(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null> {
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await this._page.reload(params.options));
|
||||
async reload(params: types.NavigateOptions): Promise<ResponseChannel | null> {
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await this._page.reload(params));
|
||||
}
|
||||
|
||||
async goBack(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null> {
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await this._page.goBack(params.options));
|
||||
async goBack(params: types.NavigateOptions): Promise<ResponseChannel | null> {
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await this._page.goBack(params));
|
||||
}
|
||||
|
||||
async goForward(params: { options?: types.NavigateOptions }): Promise<ResponseChannel | null> {
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await this._page.goForward(params.options));
|
||||
async goForward(params: types.NavigateOptions): Promise<ResponseChannel | null> {
|
||||
return lookupNullableDispatcher<ResponseDispatcher>(await this._page.goForward(params));
|
||||
}
|
||||
|
||||
async emulateMedia(params: { options: { media?: 'screen' | 'print', colorScheme?: 'dark' | 'light' | 'no-preference' } }): Promise<void> {
|
||||
await this._page.emulateMedia(params.options);
|
||||
async emulateMedia(params: { media?: 'screen' | 'print', colorScheme?: 'dark' | 'light' | 'no-preference' }): Promise<void> {
|
||||
await this._page.emulateMedia(params);
|
||||
}
|
||||
|
||||
async setViewportSize(params: { viewportSize: types.Size }): Promise<void> {
|
||||
|
|
@ -125,12 +125,12 @@ export class PageDispatcher extends Dispatcher<Page, PageInitializer> implements
|
|||
});
|
||||
}
|
||||
|
||||
async screenshot(params: { options?: types.ScreenshotOptions }): Promise<string> {
|
||||
return (await this._page.screenshot(params.options)).toString('base64');
|
||||
async screenshot(params: types.ScreenshotOptions): Promise<string> {
|
||||
return (await this._page.screenshot(params)).toString('base64');
|
||||
}
|
||||
|
||||
async close(params: { options?: { runBeforeUnload?: boolean } }): Promise<void> {
|
||||
await this._page.close(params.options);
|
||||
async close(params: { runBeforeUnload?: boolean }): Promise<void> {
|
||||
await this._page.close(params);
|
||||
}
|
||||
|
||||
async setFileChooserInterceptedNoReply(params: { intercepted: boolean }) {
|
||||
|
|
@ -152,41 +152,41 @@ export class PageDispatcher extends Dispatcher<Page, PageInitializer> implements
|
|||
await this._page.keyboard.insertText(params.text);
|
||||
}
|
||||
|
||||
async keyboardType(params: { text: string, options?: { delay?: number } }): Promise<void> {
|
||||
await this._page.keyboard.type(params.text, params.options);
|
||||
async keyboardType(params: { text: string, delay?: number }): Promise<void> {
|
||||
await this._page.keyboard.type(params.text, params);
|
||||
}
|
||||
|
||||
async keyboardPress(params: { key: string, options?: { delay?: number } }): Promise<void> {
|
||||
await this._page.keyboard.press(params.key, params.options);
|
||||
async keyboardPress(params: { key: string, delay?: number }): Promise<void> {
|
||||
await this._page.keyboard.press(params.key, params);
|
||||
}
|
||||
|
||||
async mouseMove(params: { x: number, y: number, options?: { steps?: number } }): Promise<void> {
|
||||
await this._page.mouse.move(params.x, params.y, params.options);
|
||||
async mouseMove(params: { x: number, y: number, steps?: number }): Promise<void> {
|
||||
await this._page.mouse.move(params.x, params.y, params);
|
||||
}
|
||||
|
||||
async mouseDown(params: { options?: { button?: types.MouseButton, clickCount?: number } }): Promise<void> {
|
||||
await this._page.mouse.down(params.options);
|
||||
async mouseDown(params: { button?: types.MouseButton, clickCount?: number }): Promise<void> {
|
||||
await this._page.mouse.down(params);
|
||||
}
|
||||
|
||||
async mouseUp(params: { options?: { button?: types.MouseButton, clickCount?: number } }): Promise<void> {
|
||||
await this._page.mouse.up(params.options);
|
||||
async mouseUp(params: { button?: types.MouseButton, clickCount?: number }): Promise<void> {
|
||||
await this._page.mouse.up(params);
|
||||
}
|
||||
|
||||
async mouseClick(params: { x: number, y: number, options?: { delay?: number, button?: types.MouseButton, clickCount?: number } }): Promise<void> {
|
||||
await this._page.mouse.click(params.x, params.y, params.options);
|
||||
async mouseClick(params: { x: number, y: number, delay?: number, button?: types.MouseButton, clickCount?: number }): Promise<void> {
|
||||
await this._page.mouse.click(params.x, params.y, params);
|
||||
}
|
||||
|
||||
async accessibilitySnapshot(params: { options: { interestingOnly?: boolean, root?: ElementHandleChannel } }): Promise<types.SerializedAXNode | null> {
|
||||
async accessibilitySnapshot(params: { interestingOnly?: boolean, root?: ElementHandleChannel }): Promise<types.SerializedAXNode | null> {
|
||||
return await this._page.accessibility.snapshot({
|
||||
interestingOnly: params.options.interestingOnly,
|
||||
root: params.options.root ? (params.options.root as ElementHandleDispatcher)._elementHandle : undefined
|
||||
interestingOnly: params.interestingOnly,
|
||||
root: params.root ? (params.root as ElementHandleDispatcher)._elementHandle : undefined
|
||||
});
|
||||
}
|
||||
|
||||
async pdf(params: { options?: types.PDFOptions }): Promise<Binary> {
|
||||
async pdf(params: types.PDFOptions): Promise<Binary> {
|
||||
if (!this._page.pdf)
|
||||
throw new Error('PDF generation is only supported for Headless Chromium');
|
||||
const binary = await this._page.pdf(params.options);
|
||||
const binary = await this._page.pdf(params);
|
||||
return binary.toString('base64');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue