UNPKG

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