UNPKG

webdriver

Version:

A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol

64 lines 3.07 kB
/// <reference types="node" resolution-mode="require"/> /// <reference types="node" resolution-mode="require"/> import type { EventEmitter } from 'node:events'; import type { Options, Capabilities } from '@wdio/types'; import type { WebDriverResponse } from './request/index.js'; import type { Client, JSONWPCommandError, SessionFlags } from './types.js'; /** * start browser session with WebDriver protocol */ export declare function startWebDriverSession(params: Options.WebDriver): Promise<{ sessionId: string; capabilities: Capabilities.DesiredCapabilities; }>; /** * check if WebDriver requests was successful * @param {number} statusCode status code of request * @param {Object} body body payload of response * @return {Boolean} true if request was successful */ export declare function isSuccessfulResponse(statusCode?: number, body?: WebDriverResponse): boolean; /** * creates the base prototype for the webdriver monad */ export declare function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSeleniumStandalone }: Partial<SessionFlags>): Record<string, PropertyDescriptor>; /** * helper method to determine the error from webdriver response * @param {Object} body body object * @return {Object} error */ export declare function getErrorFromResponseBody(body: any, requestOptions: any): Error; export declare class CustomRequestError extends Error { constructor(body: WebDriverResponse, requestOptions: any); } /** * return all supported flags and return them in a format so we can attach them * to the instance protocol * @param {Object} options driver instance or option object containing these flags * @return {Object} prototype object */ export declare function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi, isChromium }: Partial<SessionFlags>): PropertyDescriptorMap; /** * Decorate the client's options object with host updates based on the presence of * directConnect capabilities in the new session response. Note that this * mutates the object. * @param {Client} params post-new-session client */ export declare function setupDirectConnect(client: Client): void; /** * get human readable message from response error * @param {Error} err response error */ export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string; /** * return timeout error with information about the executing command on which the test hangs */ export declare const getTimeoutError: (error: Error, requestOptions: Options.RequestLibOptions) => Error; /** * Enhance the monad with WebDriver Bidi primitives if a connection can be established successfully * @param socketUrl url to bidi interface * @returns prototype with interface for bidi primitives */ export declare function initiateBidi(socketUrl: string, strictSSL?: boolean): PropertyDescriptorMap; export declare function parseBidiMessage(this: EventEmitter, data: Buffer): void; //# sourceMappingURL=utils.d.ts.map