import type { Page } from 'playwright'; import type { Media, SelectOptionPayload, SendKeysPayload, SendMousePayload, Viewport } from './types.js'; import type { LocatorActionPayload } from './locator.js'; import type { PageScreenshotOptions } from './screenshot.js'; import type { Geolocation, GrantPermissionsOptions } from './emulation.js'; import type { FileChooserSetFilesOptions } from './file_chooser.js'; export interface EmulatePayload { action: 'setViewport' | 'emulateMedia' | 'setGeolocation' | 'grantPermissions' | 'clearPermissions' | 'setOffline'; viewport?: Viewport; media?: Media; geolocation?: Geolocation; permissions?: string[]; permissionOptions?: GrantPermissionsOptions; offline?: boolean; } interface KeyboardActionPayload { action: 'down' | 'insertText' | 'press' | 'type' | 'up'; key?: string; text?: string; options?: { delay?: number; }; } /** * A class that handles the RPC calls from the browser to the runner. */ export declare class CommandsHandler { protected page: Page; private closeHandler?; private network; private activeFileChoosers; constructor(page: Page); /** * Expose the RPC handler to the browser. */ boot(): Promise; teardown(): Promise; /** * Handle network:mock:enable command */ protected handleNetworkEnable(): Promise; /** * Handle network:mock:disable command */ protected handleNetworkDisable(): Promise; /** * Handle setViewport command. */ protected handleSetViewport(payload: Viewport): Promise; /** * Handle emulateMedia command. */ protected handleEmulateMedia(payload: Media): Promise; /** * Handle emulate command. */ protected handleEmulate(payload: EmulatePayload): Promise; /** * Handle sendKeys command. */ protected handleSendKeys(payload: SendKeysPayload): Promise; /** * Handle sendMouse command. */ protected handleSendMouse(payload: SendMousePayload): Promise; /** * Handle resetMouse command. */ protected handleResetMouse(): Promise; /** * Handle mouse command gestures. */ protected handleMouse(payload: any): Promise; /** * Handle keyboard command. */ protected handleKeyboard(payload: KeyboardActionPayload): Promise; /** * Handle screenshot command. */ protected handleScreenshot(payload: { action: 'take'; options: PageScreenshotOptions; }): Promise; /** * Handle selectOption command. */ protected handleSelectOption(payload: SelectOptionPayload): Promise; protected handleLocator(payload: LocatorActionPayload): Promise; /** * Handle fileChooser:waitForEvent command. */ protected handleFileChooserWaitForEvent(options?: { timeout?: number; }): Promise<{ id: string; isMultiple: boolean; }>; /** * Handle fileChooser:setFiles command. */ protected handleFileChooserSetFiles(payload: { id: string; files: string | string[]; options?: FileChooserSetFilesOptions; }): Promise; private getLocator; } export {};