UNPKG

webdriver

Version:

A Node.js bindings implementation for the W3C WebDriver and WebDriver Bidi protocols

46 lines • 2.02 kB
import type { ClientOptions, WebSocket } from 'ws'; import type { CommandData } from './remoteTypes.js'; import type { CommandResponse } from './localTypes.js'; import type { Client } from '../types.js'; export declare const DEFAULT_RESPONSE_TIMEOUT: number; /** * Set this symbol on a command's `params` to keep its values out of logs and * `bidiCommand` events, e.g. text typed with `setValue(value, { mask: true })`. * `JSON.stringify` skips symbol keys, so the command is sent unchanged. */ export declare const BIDI_MASK: unique symbol; export declare class BidiCore { #private; client: Client | undefined; /** * @private */ private _isConnected; constructor(webSocketUrl: string, opts?: ClientOptions, responseTimeout?: number); /** * We initiate the Bidi instance before a WebdriverIO instance is created. * In order to emit Bidi events we have to attach the WebdriverIO instance * to the Bidi instance afterwards. */ attachClient(client: Client): void; connect(): Promise<boolean>; close(): void; reconnect(webSocketUrl: string, opts?: ClientOptions): Promise<boolean>; /** * Helper function that allows to wait until Bidi connection establishes * @returns a promise that resolves once the connection to WebDriver Bidi protocol was established */ waitForConnected(): Promise<boolean>; get socket(): WebSocket | undefined; get isConnected(): boolean; send(params: Omit<CommandData, 'id'>): Promise<CommandResponse>; sendAsync(params: Omit<CommandData, 'id'>): number; } /** * A copy of the command to log when its params carry `BIDI_MASK`. Key action * values are replaced, so the log still shows the shape of the input. * Any other masked command hides all of its params. */ export declare function maskBidiCommand(params: Omit<CommandData, 'id'>): Omit<CommandData, 'id'>; export declare function parseBidiCommand(params: Omit<CommandData, 'id'>): string[]; //# sourceMappingURL=core.d.ts.map