UNPKG

2.61 kBTypeScriptView Raw
1import type { EventEmitter } from 'node:events';
2import type { Options } from '@wdio/types';
3import type { Client, JSONWPCommandError, SessionFlags, RemoteConfig } from './types.js';
4/**
5 * start browser session with WebDriver protocol
6 */
7export declare function startWebDriverSession(params: RemoteConfig): Promise<{
8 sessionId: string;
9 capabilities: WebdriverIO.Capabilities;
10}>;
11/**
12 * Validates the given WebdriverIO capabilities.
13 *
14 * @param {WebdriverIO.Capabilities} capabilities - The capabilities to validate.
15 * @throws {Error} If the capabilities contain incognito mode.
16 */
17export declare function validateCapabilities(capabilities: WebdriverIO.Capabilities): void;
18/**
19 * check if WebDriver requests was successful
20 * @param {number} statusCode status code of request
21 * @param {Object} body body payload of response
22 * @return {Boolean} true if request was successful
23 */
24export declare function isSuccessfulResponse(statusCode?: number, body?: unknown): boolean;
25/**
26 * creates the base prototype for the webdriver monad
27 */
28export declare function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSeleniumStandalone }: Partial<SessionFlags>): Record<string, PropertyDescriptor>;
29/**
30 * return all supported flags and return them in a format so we can attach them
31 * to the instance protocol
32 * @param {Object} options driver instance or option object containing these flags
33 * @return {Object} prototype object
34 */
35export declare function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isChromium }: Partial<SessionFlags>): PropertyDescriptorMap;
36/**
37 * Decorate the client's options object with host updates based on the presence of
38 * directConnect capabilities in the new session response. Note that this
39 * mutates the object.
40 * @param {Client} params post-new-session client
41 */
42export declare function setupDirectConnect(client: Client): void;
43/**
44 * get human readable message from response error
45 * @param {Error} err response error
46 */
47export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string;
48/**
49 * Enhance the monad with WebDriver Bidi primitives if a connection can be established successfully
50 * @param socketUrl url to bidi interface
51 * @returns prototype with interface for bidi primitives
52 */
53export declare function initiateBidi(socketUrl: string, strictSSL?: boolean): PropertyDescriptorMap;
54export declare function parseBidiMessage(this: EventEmitter, data: Buffer): void;
55//# sourceMappingURL=utils.d.ts.map
\No newline at end of file