webdriver 9.1.0 → 9.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/command.d.ts +1 -1
- package/build/command.d.ts.map +1 -1
- package/build/constants.d.ts +0 -4
- package/build/constants.d.ts.map +1 -1
- package/build/index.cjs +88 -7
- package/build/index.js +263 -239
- package/build/request/constants.d.ts +8 -0
- package/build/request/constants.d.ts.map +1 -1
- package/build/request/error.d.ts +25 -0
- package/build/request/error.d.ts.map +1 -0
- package/build/request/index.d.ts +1 -20
- package/build/request/index.d.ts.map +1 -1
- package/build/request/request.d.ts.map +1 -1
- package/build/request/types.d.ts +16 -0
- package/build/request/types.d.ts.map +1 -0
- package/build/utils.d.ts +1 -14
- package/build/utils.d.ts.map +1 -1
- package/package.json +5 -5
package/build/command.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CommandEndpoint } from '@wdio/protocols';
|
|
2
|
-
import type { WebDriverResponse } from './request/
|
|
2
|
+
import type { WebDriverResponse } from './request/types.js';
|
|
3
3
|
import type { BaseClient, BidiResponses } from './types.js';
|
|
4
4
|
export default function (method: string, endpointUri: string, commandInfo: CommandEndpoint, doubleEncodeVariables?: boolean): (this: BaseClient, ...args: any[]) => Promise<WebDriverResponse | BidiResponses | void>;
|
|
5
5
|
//# sourceMappingURL=command.d.ts.map
|
package/build/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAG7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAA;AAKzE,MAAM,CAAC,OAAO,WACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,EAC5B,qBAAqB,UAAQ,UAIgB,UAAU,WAAW,GAAG,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CA0J9H"}
|
package/build/constants.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { Options } from '@wdio/types';
|
|
2
2
|
import type { RemoteConfig } from './types.js';
|
|
3
3
|
export declare const DEFAULTS: Options.Definition<Required<RemoteConfig>>;
|
|
4
|
-
export declare const REG_EXPS: {
|
|
5
|
-
commandName: RegExp;
|
|
6
|
-
execFn: RegExp;
|
|
7
|
-
};
|
|
8
4
|
export declare const ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
|
|
9
5
|
export declare const SHADOW_ELEMENT_KEY = "shadow-6066-11e4-a52e-4f735466cecf";
|
|
10
6
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CA2I/D,CAAA;AAED,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CA2I/D,CAAA;AAED,eAAO,MAAM,WAAW,wCAAwC,CAAA;AAChE,eAAO,MAAM,kBAAkB,uCAAuC,CAAA"}
|
package/build/index.cjs
CHANGED
|
@@ -30,6 +30,82 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
mod
|
|
31
31
|
));
|
|
32
32
|
|
|
33
|
+
// src/request/constants.ts
|
|
34
|
+
var REG_EXPS;
|
|
35
|
+
var init_constants = __esm({
|
|
36
|
+
"src/request/constants.ts"() {
|
|
37
|
+
"use strict";
|
|
38
|
+
REG_EXPS = {
|
|
39
|
+
commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
|
|
40
|
+
execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/request/error.ts
|
|
46
|
+
var import_utils, WebDriverError, WebDriverRequestError;
|
|
47
|
+
var init_error = __esm({
|
|
48
|
+
"src/request/error.ts"() {
|
|
49
|
+
"use strict";
|
|
50
|
+
import_utils = require("@wdio/utils");
|
|
51
|
+
init_constants();
|
|
52
|
+
WebDriverError = class extends Error {
|
|
53
|
+
/**
|
|
54
|
+
* return timeout error with information about the executing command on which the test hangs
|
|
55
|
+
*/
|
|
56
|
+
computeErrorMessage() {
|
|
57
|
+
const cmdName = this.#getExecCmdName();
|
|
58
|
+
const cmdArgs = this.#getExecCmdArgs(this.opts);
|
|
59
|
+
const cmdInfoMsg = `when running "${cmdName}" with method "${this.opts.method}"`;
|
|
60
|
+
const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : "";
|
|
61
|
+
return `WebDriverError: ${this.message} ${cmdInfoMsg}${cmdArgsMsg}`;
|
|
62
|
+
}
|
|
63
|
+
#getExecCmdName() {
|
|
64
|
+
const { href } = this.url;
|
|
65
|
+
const res = href.match(REG_EXPS.commandName) || [];
|
|
66
|
+
return res[1] || href;
|
|
67
|
+
}
|
|
68
|
+
#getExecCmdArgs(requestOptions) {
|
|
69
|
+
const { body: cmdJson } = requestOptions;
|
|
70
|
+
if (typeof cmdJson !== "object") {
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
const transformedRes = (0, import_utils.transformCommandLogResult)(cmdJson);
|
|
74
|
+
if (typeof transformedRes === "string") {
|
|
75
|
+
return transformedRes;
|
|
76
|
+
}
|
|
77
|
+
if (typeof cmdJson.script === "string") {
|
|
78
|
+
const scriptRes = cmdJson.script.match(REG_EXPS.execFn) || [];
|
|
79
|
+
return `"${scriptRes[1] || cmdJson.script}"`;
|
|
80
|
+
}
|
|
81
|
+
return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : "";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
WebDriverRequestError = class extends WebDriverError {
|
|
85
|
+
url;
|
|
86
|
+
opts;
|
|
87
|
+
statusCode;
|
|
88
|
+
body;
|
|
89
|
+
code;
|
|
90
|
+
constructor(err, url, opts) {
|
|
91
|
+
let message = err.message;
|
|
92
|
+
if (err.message === "fetch failed") {
|
|
93
|
+
message = `Failed to fetch [${opts.method}] ${url.href}: please make sure you have a WebDriver compatible server running on ${url.origin}`;
|
|
94
|
+
}
|
|
95
|
+
super(message);
|
|
96
|
+
this.url = url;
|
|
97
|
+
this.opts = opts;
|
|
98
|
+
const errorCode = typeof err.cause === "object" && err.cause && "code" in err.cause && typeof err.cause.code === "string" ? err.cause.code : "code" in err && typeof err.code === "string" ? err.code : void 0;
|
|
99
|
+
if (errorCode) {
|
|
100
|
+
this.code = errorCode;
|
|
101
|
+
this.message = errorCode === "UND_ERR_CONNECT_TIMEOUT" ? 'Request timed out! Consider increasing the "connectionRetryTimeout" option.' : "Request failed with error code " + errorCode;
|
|
102
|
+
}
|
|
103
|
+
this.message = this.computeErrorMessage();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
33
109
|
// src/request/request.ts
|
|
34
110
|
var import_node_perf_hooks, import_node_dns, import_index, FetchRequest;
|
|
35
111
|
var init_request = __esm({
|
|
@@ -38,6 +114,7 @@ var init_request = __esm({
|
|
|
38
114
|
import_node_perf_hooks = require("node:perf_hooks");
|
|
39
115
|
import_node_dns = __toESM(require("node:dns"), 1);
|
|
40
116
|
import_index = __toESM(require("./index.js"), 1);
|
|
117
|
+
init_error();
|
|
41
118
|
if ("process" in globalThis && globalThis.process.versions?.node) {
|
|
42
119
|
import_node_dns.default.setDefaultResultOrder("ipv4first");
|
|
43
120
|
}
|
|
@@ -60,9 +137,13 @@ var init_request = __esm({
|
|
|
60
137
|
};
|
|
61
138
|
} catch (err) {
|
|
62
139
|
if (!(err instanceof Error)) {
|
|
63
|
-
throw new
|
|
140
|
+
throw new WebDriverRequestError(
|
|
141
|
+
new Error(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`),
|
|
142
|
+
url,
|
|
143
|
+
opts
|
|
144
|
+
);
|
|
64
145
|
}
|
|
65
|
-
throw err;
|
|
146
|
+
throw new WebDriverRequestError(err, url, opts);
|
|
66
147
|
}
|
|
67
148
|
}
|
|
68
149
|
_libPerformanceNow() {
|
|
@@ -122,11 +203,11 @@ Usage: ${commandUsage}` + parameterDescription + moreInfo
|
|
|
122
203
|
}
|
|
123
204
|
const i = parseInt(it, 10);
|
|
124
205
|
const commandParam = commandParams[i];
|
|
125
|
-
if (!(0,
|
|
206
|
+
if (!(0, import_utils2.isValidParameter)(arg, commandParam.type)) {
|
|
126
207
|
if (typeof arg === "undefined" && !commandParam.required) {
|
|
127
208
|
continue;
|
|
128
209
|
}
|
|
129
|
-
const actual = commandParam.type.endsWith("[]") ? `(${(Array.isArray(arg) ? arg : [arg]).map((a) => (0,
|
|
210
|
+
const actual = commandParam.type.endsWith("[]") ? `(${(Array.isArray(arg) ? arg : [arg]).map((a) => (0, import_utils2.getArgumentType)(a))})[]` : (0, import_utils2.getArgumentType)(arg);
|
|
130
211
|
throw new Error(
|
|
131
212
|
`Malformed type for "${commandParam.name}" parameter of command ${command2}
|
|
132
213
|
Expected: ${commandParam.type}
|
|
@@ -143,7 +224,7 @@ Actual: ${actual}` + moreInfo
|
|
|
143
224
|
const request = new FetchRequest(method, endpoint, body, isHubCommand);
|
|
144
225
|
request.on("performance", (...args2) => this.emit("request.performance", ...args2));
|
|
145
226
|
this.emit("command", { command: command2, method, endpoint, body });
|
|
146
|
-
log.info("COMMAND", (0,
|
|
227
|
+
log.info("COMMAND", (0, import_utils2.commandCallStructure)(command2, args));
|
|
147
228
|
return request.makeRequest(this.options, this.sessionId).then((result) => {
|
|
148
229
|
if (typeof result.value !== "undefined") {
|
|
149
230
|
let resultLog = result.value;
|
|
@@ -179,12 +260,12 @@ Actual: ${actual}` + moreInfo
|
|
|
179
260
|
});
|
|
180
261
|
};
|
|
181
262
|
}
|
|
182
|
-
var import_logger,
|
|
263
|
+
var import_logger, import_utils2, import_protocols, log, BIDI_COMMANDS;
|
|
183
264
|
var init_command = __esm({
|
|
184
265
|
"src/command.ts"() {
|
|
185
266
|
"use strict";
|
|
186
267
|
import_logger = __toESM(require("@wdio/logger"), 1);
|
|
187
|
-
|
|
268
|
+
import_utils2 = require("@wdio/utils");
|
|
188
269
|
import_protocols = require("@wdio/protocols");
|
|
189
270
|
init_request();
|
|
190
271
|
log = (0, import_logger.default)("webdriver");
|
package/build/index.js
CHANGED
|
@@ -6,9 +6,7 @@ import { validateConfig } from "@wdio/config";
|
|
|
6
6
|
// src/command.ts
|
|
7
7
|
import logger4 from "@wdio/logger";
|
|
8
8
|
import { commandCallStructure, isValidParameter, getArgumentType } from "@wdio/utils";
|
|
9
|
-
import {
|
|
10
|
-
WebDriverBidiProtocol as WebDriverBidiProtocol2
|
|
11
|
-
} from "@wdio/protocols";
|
|
9
|
+
import { WebDriverBidiProtocol as WebDriverBidiProtocol2 } from "@wdio/protocols";
|
|
12
10
|
|
|
13
11
|
// src/request/request.ts
|
|
14
12
|
import { performance } from "node:perf_hooks";
|
|
@@ -22,8 +20,107 @@ import { URL } from "node:url";
|
|
|
22
20
|
import logger3 from "@wdio/logger";
|
|
23
21
|
import { transformCommandLogResult as transformCommandLogResult2 } from "@wdio/utils";
|
|
24
22
|
|
|
23
|
+
// src/request/error.ts
|
|
24
|
+
import { transformCommandLogResult } from "@wdio/utils";
|
|
25
|
+
|
|
25
26
|
// src/request/constants.ts
|
|
26
27
|
var RETRYABLE_STATUS_CODES = [408, 413, 429, 500, 502, 503, 504];
|
|
28
|
+
var RETRYABLE_ERROR_CODES = [
|
|
29
|
+
"ETIMEDOUT",
|
|
30
|
+
"ECONNRESET",
|
|
31
|
+
"EADDRINUSE",
|
|
32
|
+
"ECONNREFUSED",
|
|
33
|
+
"EPIPE",
|
|
34
|
+
"ENOTFOUND",
|
|
35
|
+
"ENETUNREACH",
|
|
36
|
+
"EAI_AGAIN",
|
|
37
|
+
// additional error codes we like to retry
|
|
38
|
+
"UND_ERR_CONNECT_TIMEOUT"
|
|
39
|
+
];
|
|
40
|
+
var REG_EXPS = {
|
|
41
|
+
commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
|
|
42
|
+
execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// src/request/error.ts
|
|
46
|
+
var WebDriverError = class extends Error {
|
|
47
|
+
/**
|
|
48
|
+
* return timeout error with information about the executing command on which the test hangs
|
|
49
|
+
*/
|
|
50
|
+
computeErrorMessage() {
|
|
51
|
+
const cmdName = this.#getExecCmdName();
|
|
52
|
+
const cmdArgs = this.#getExecCmdArgs(this.opts);
|
|
53
|
+
const cmdInfoMsg = `when running "${cmdName}" with method "${this.opts.method}"`;
|
|
54
|
+
const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : "";
|
|
55
|
+
return `WebDriverError: ${this.message} ${cmdInfoMsg}${cmdArgsMsg}`;
|
|
56
|
+
}
|
|
57
|
+
#getExecCmdName() {
|
|
58
|
+
const { href } = this.url;
|
|
59
|
+
const res = href.match(REG_EXPS.commandName) || [];
|
|
60
|
+
return res[1] || href;
|
|
61
|
+
}
|
|
62
|
+
#getExecCmdArgs(requestOptions) {
|
|
63
|
+
const { body: cmdJson } = requestOptions;
|
|
64
|
+
if (typeof cmdJson !== "object") {
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
const transformedRes = transformCommandLogResult(cmdJson);
|
|
68
|
+
if (typeof transformedRes === "string") {
|
|
69
|
+
return transformedRes;
|
|
70
|
+
}
|
|
71
|
+
if (typeof cmdJson.script === "string") {
|
|
72
|
+
const scriptRes = cmdJson.script.match(REG_EXPS.execFn) || [];
|
|
73
|
+
return `"${scriptRes[1] || cmdJson.script}"`;
|
|
74
|
+
}
|
|
75
|
+
return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : "";
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var WebDriverRequestError = class extends WebDriverError {
|
|
79
|
+
url;
|
|
80
|
+
opts;
|
|
81
|
+
statusCode;
|
|
82
|
+
body;
|
|
83
|
+
code;
|
|
84
|
+
constructor(err, url, opts) {
|
|
85
|
+
let message = err.message;
|
|
86
|
+
if (err.message === "fetch failed") {
|
|
87
|
+
message = `Failed to fetch [${opts.method}] ${url.href}: please make sure you have a WebDriver compatible server running on ${url.origin}`;
|
|
88
|
+
}
|
|
89
|
+
super(message);
|
|
90
|
+
this.url = url;
|
|
91
|
+
this.opts = opts;
|
|
92
|
+
const errorCode = typeof err.cause === "object" && err.cause && "code" in err.cause && typeof err.cause.code === "string" ? err.cause.code : "code" in err && typeof err.code === "string" ? err.code : void 0;
|
|
93
|
+
if (errorCode) {
|
|
94
|
+
this.code = errorCode;
|
|
95
|
+
this.message = errorCode === "UND_ERR_CONNECT_TIMEOUT" ? 'Request timed out! Consider increasing the "connectionRetryTimeout" option.' : "Request failed with error code " + errorCode;
|
|
96
|
+
}
|
|
97
|
+
this.message = this.computeErrorMessage();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var WebDriverResponseError = class _WebDriverResponseError extends WebDriverError {
|
|
101
|
+
url;
|
|
102
|
+
opts;
|
|
103
|
+
constructor(response, url, opts) {
|
|
104
|
+
const errorObj = !response.body ? new Error("Response has empty body") : typeof response.body === "string" && response.body.length ? new Error(response.body) : typeof response.body !== "object" ? new Error("Unknown error") : response.body.value || response.body;
|
|
105
|
+
let errorMessage = errorObj.message || errorObj.error || errorObj.class || "unknown error";
|
|
106
|
+
if (typeof errorMessage === "string" && errorMessage.includes("invalid locator")) {
|
|
107
|
+
const requestOptions = opts.body;
|
|
108
|
+
errorMessage = `The selector "${requestOptions.value}" used with strategy "${requestOptions.using}" is invalid!`;
|
|
109
|
+
}
|
|
110
|
+
super(errorMessage);
|
|
111
|
+
if (errorObj.error) {
|
|
112
|
+
this.name = errorObj.error;
|
|
113
|
+
} else if (errorMessage && errorMessage.includes("stale element reference")) {
|
|
114
|
+
this.name = "stale element reference";
|
|
115
|
+
} else {
|
|
116
|
+
this.name = errorObj.name || "WebDriver Error";
|
|
117
|
+
}
|
|
118
|
+
Error.captureStackTrace(this, _WebDriverResponseError);
|
|
119
|
+
this.url = url;
|
|
120
|
+
this.opts = opts;
|
|
121
|
+
this.message = this.computeErrorMessage();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
27
124
|
|
|
28
125
|
// src/utils.ts
|
|
29
126
|
import { deepmergeCustom } from "deepmerge-ts";
|
|
@@ -38,7 +135,6 @@ import {
|
|
|
38
135
|
GeckoProtocol,
|
|
39
136
|
WebDriverBidiProtocol
|
|
40
137
|
} from "@wdio/protocols";
|
|
41
|
-
import { transformCommandLogResult } from "@wdio/utils";
|
|
42
138
|
import { CAPABILITY_KEYS } from "@wdio/protocols";
|
|
43
139
|
|
|
44
140
|
// src/bidi/core.ts
|
|
@@ -716,154 +812,6 @@ var BidiHandler = class extends BidiCore {
|
|
|
716
812
|
}
|
|
717
813
|
};
|
|
718
814
|
|
|
719
|
-
// src/constants.ts
|
|
720
|
-
import os from "node:os";
|
|
721
|
-
var DEFAULTS = {
|
|
722
|
-
/**
|
|
723
|
-
* protocol of automation driver
|
|
724
|
-
*/
|
|
725
|
-
protocol: {
|
|
726
|
-
type: "string",
|
|
727
|
-
default: "http",
|
|
728
|
-
match: /(http|https)/
|
|
729
|
-
},
|
|
730
|
-
/**
|
|
731
|
-
* hostname of automation driver
|
|
732
|
-
*/
|
|
733
|
-
hostname: {
|
|
734
|
-
type: "string",
|
|
735
|
-
default: "localhost"
|
|
736
|
-
},
|
|
737
|
-
/**
|
|
738
|
-
* port of automation driver
|
|
739
|
-
*/
|
|
740
|
-
port: {
|
|
741
|
-
type: "number"
|
|
742
|
-
},
|
|
743
|
-
/**
|
|
744
|
-
* path to WebDriver endpoints
|
|
745
|
-
*/
|
|
746
|
-
path: {
|
|
747
|
-
type: "string",
|
|
748
|
-
validate: (path2) => {
|
|
749
|
-
if (!path2.startsWith("/")) {
|
|
750
|
-
throw new TypeError('The option "path" needs to start with a "/"');
|
|
751
|
-
}
|
|
752
|
-
return true;
|
|
753
|
-
},
|
|
754
|
-
default: "/"
|
|
755
|
-
},
|
|
756
|
-
/**
|
|
757
|
-
* A key-value store of query parameters to be added to every selenium request
|
|
758
|
-
*/
|
|
759
|
-
queryParams: {
|
|
760
|
-
type: "object"
|
|
761
|
-
},
|
|
762
|
-
/**
|
|
763
|
-
* cloud user if applicable
|
|
764
|
-
*/
|
|
765
|
-
user: {
|
|
766
|
-
type: "string"
|
|
767
|
-
},
|
|
768
|
-
/**
|
|
769
|
-
* access key to user
|
|
770
|
-
*/
|
|
771
|
-
key: {
|
|
772
|
-
type: "string"
|
|
773
|
-
},
|
|
774
|
-
/**
|
|
775
|
-
* capability of WebDriver session
|
|
776
|
-
*/
|
|
777
|
-
capabilities: {
|
|
778
|
-
type: "object",
|
|
779
|
-
required: true
|
|
780
|
-
},
|
|
781
|
-
/**
|
|
782
|
-
* Level of logging verbosity
|
|
783
|
-
*/
|
|
784
|
-
logLevel: {
|
|
785
|
-
type: "string",
|
|
786
|
-
default: "info",
|
|
787
|
-
match: /(trace|debug|info|warn|error|silent)/
|
|
788
|
-
},
|
|
789
|
-
/**
|
|
790
|
-
* directory for log files
|
|
791
|
-
*/
|
|
792
|
-
outputDir: {
|
|
793
|
-
type: "string"
|
|
794
|
-
},
|
|
795
|
-
/**
|
|
796
|
-
* Timeout for any WebDriver request to a driver or grid
|
|
797
|
-
*/
|
|
798
|
-
connectionRetryTimeout: {
|
|
799
|
-
type: "number",
|
|
800
|
-
default: 12e4
|
|
801
|
-
},
|
|
802
|
-
/**
|
|
803
|
-
* Count of request retries to the Selenium server
|
|
804
|
-
*/
|
|
805
|
-
connectionRetryCount: {
|
|
806
|
-
type: "number",
|
|
807
|
-
default: 3
|
|
808
|
-
},
|
|
809
|
-
/**
|
|
810
|
-
* Override default agent
|
|
811
|
-
*/
|
|
812
|
-
logLevels: {
|
|
813
|
-
type: "object"
|
|
814
|
-
},
|
|
815
|
-
/**
|
|
816
|
-
* Pass custom headers
|
|
817
|
-
*/
|
|
818
|
-
headers: {
|
|
819
|
-
type: "object"
|
|
820
|
-
},
|
|
821
|
-
/**
|
|
822
|
-
* Function transforming the request options before the request is made
|
|
823
|
-
*/
|
|
824
|
-
transformRequest: {
|
|
825
|
-
type: "function",
|
|
826
|
-
default: (requestOptions) => requestOptions
|
|
827
|
-
},
|
|
828
|
-
/**
|
|
829
|
-
* Function transforming the response object after it is received
|
|
830
|
-
*/
|
|
831
|
-
transformResponse: {
|
|
832
|
-
type: "function",
|
|
833
|
-
default: (response) => response
|
|
834
|
-
},
|
|
835
|
-
/**
|
|
836
|
-
* Appium direct connect options server (https://appiumpro.com/editions/86-connecting-directly-to-appium-hosts-in-distributed-environments)
|
|
837
|
-
* Whether to allow direct connect caps to adjust endpoint details (Appium only)
|
|
838
|
-
*/
|
|
839
|
-
enableDirectConnect: {
|
|
840
|
-
type: "boolean",
|
|
841
|
-
default: true
|
|
842
|
-
},
|
|
843
|
-
/**
|
|
844
|
-
* Whether it requires SSL certificates to be valid in HTTP/s requests
|
|
845
|
-
* for an environment which cannot get process environment well.
|
|
846
|
-
*/
|
|
847
|
-
strictSSL: {
|
|
848
|
-
type: "boolean",
|
|
849
|
-
default: true
|
|
850
|
-
},
|
|
851
|
-
/**
|
|
852
|
-
* The path to the root of the cache directory. This directory is used to store all drivers that are downloaded
|
|
853
|
-
* when attempting to start a session.
|
|
854
|
-
*/
|
|
855
|
-
cacheDir: {
|
|
856
|
-
type: "string",
|
|
857
|
-
default: process.env.WEBDRIVER_CACHE_DIR || os.tmpdir()
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
var REG_EXPS = {
|
|
861
|
-
commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
|
|
862
|
-
execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
|
|
863
|
-
};
|
|
864
|
-
var ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
|
|
865
|
-
var SHADOW_ELEMENT_KEY = "shadow-6066-11e4-a52e-4f735466cecf";
|
|
866
|
-
|
|
867
815
|
// src/utils.ts
|
|
868
816
|
var log2 = logger2("webdriver");
|
|
869
817
|
var deepmerge = deepmergeCustom({ mergeArrays: false });
|
|
@@ -995,36 +943,6 @@ function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSelen
|
|
|
995
943
|
}
|
|
996
944
|
return prototype;
|
|
997
945
|
}
|
|
998
|
-
function getErrorFromResponseBody(body, requestOptions) {
|
|
999
|
-
if (!body) {
|
|
1000
|
-
return new Error("Response has empty body");
|
|
1001
|
-
}
|
|
1002
|
-
if (typeof body === "string" && body.length) {
|
|
1003
|
-
return new Error(body);
|
|
1004
|
-
}
|
|
1005
|
-
if (typeof body !== "object") {
|
|
1006
|
-
return new Error("Unknown error");
|
|
1007
|
-
}
|
|
1008
|
-
return new CustomRequestError(body, requestOptions);
|
|
1009
|
-
}
|
|
1010
|
-
var CustomRequestError = class _CustomRequestError extends Error {
|
|
1011
|
-
constructor(body, requestOptions) {
|
|
1012
|
-
const errorObj = body.value || body;
|
|
1013
|
-
let errorMessage = errorObj.message || errorObj.error || errorObj.class || "unknown error";
|
|
1014
|
-
if (typeof errorMessage === "string" && errorMessage.includes("invalid locator")) {
|
|
1015
|
-
errorMessage = `The selector "${requestOptions.value}" used with strategy "${requestOptions.using}" is invalid!`;
|
|
1016
|
-
}
|
|
1017
|
-
super(errorMessage);
|
|
1018
|
-
if (errorObj.error) {
|
|
1019
|
-
this.name = errorObj.error;
|
|
1020
|
-
} else if (errorMessage && errorMessage.includes("stale element reference")) {
|
|
1021
|
-
this.name = "stale element reference";
|
|
1022
|
-
} else {
|
|
1023
|
-
this.name = errorObj.name || "WebDriver Error";
|
|
1024
|
-
}
|
|
1025
|
-
Error.captureStackTrace(this, _CustomRequestError);
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
946
|
function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi: isBidi2, isChromium }) {
|
|
1029
947
|
return {
|
|
1030
948
|
isW3C: { value: isW3C },
|
|
@@ -1084,34 +1002,6 @@ It seems like the service failed to start or is rejecting any connections.`;
|
|
|
1084
1002
|
}
|
|
1085
1003
|
return err.message;
|
|
1086
1004
|
};
|
|
1087
|
-
function getRequestError(error, requestOptions, url) {
|
|
1088
|
-
const cmdName = getExecCmdName(url);
|
|
1089
|
-
const cmdArgs = getExecCmdArgs(requestOptions);
|
|
1090
|
-
const cmdInfoMsg = `when running "${cmdName}" with method "${requestOptions.method}"`;
|
|
1091
|
-
const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : "";
|
|
1092
|
-
const timeoutErr = new Error(`${error.message} ${cmdInfoMsg}${cmdArgsMsg}`);
|
|
1093
|
-
return Object.assign(timeoutErr, error);
|
|
1094
|
-
}
|
|
1095
|
-
function getExecCmdName(url) {
|
|
1096
|
-
const { href } = url;
|
|
1097
|
-
const res = href.match(REG_EXPS.commandName) || [];
|
|
1098
|
-
return res[1] || href;
|
|
1099
|
-
}
|
|
1100
|
-
function getExecCmdArgs(requestOptions) {
|
|
1101
|
-
const { body: cmdJson } = requestOptions;
|
|
1102
|
-
if (typeof cmdJson !== "object") {
|
|
1103
|
-
return "";
|
|
1104
|
-
}
|
|
1105
|
-
const transformedRes = transformCommandLogResult(cmdJson);
|
|
1106
|
-
if (typeof transformedRes === "string") {
|
|
1107
|
-
return transformedRes;
|
|
1108
|
-
}
|
|
1109
|
-
if (typeof cmdJson.script === "string") {
|
|
1110
|
-
const scriptRes = cmdJson.script.match(REG_EXPS.execFn) || [];
|
|
1111
|
-
return `"${scriptRes[1] || cmdJson.script}"`;
|
|
1112
|
-
}
|
|
1113
|
-
return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : "";
|
|
1114
|
-
}
|
|
1115
1005
|
function initiateBidi(socketUrl, strictSSL = true) {
|
|
1116
1006
|
socketUrl = socketUrl.replace("localhost", "127.0.0.1");
|
|
1117
1007
|
const bidiReqOpts = strictSSL ? {} : { rejectUnauthorized: false };
|
|
@@ -1139,10 +1029,154 @@ function parseBidiMessage(data) {
|
|
|
1139
1029
|
}
|
|
1140
1030
|
}
|
|
1141
1031
|
|
|
1032
|
+
// src/constants.ts
|
|
1033
|
+
import os from "node:os";
|
|
1034
|
+
var DEFAULTS = {
|
|
1035
|
+
/**
|
|
1036
|
+
* protocol of automation driver
|
|
1037
|
+
*/
|
|
1038
|
+
protocol: {
|
|
1039
|
+
type: "string",
|
|
1040
|
+
default: "http",
|
|
1041
|
+
match: /(http|https)/
|
|
1042
|
+
},
|
|
1043
|
+
/**
|
|
1044
|
+
* hostname of automation driver
|
|
1045
|
+
*/
|
|
1046
|
+
hostname: {
|
|
1047
|
+
type: "string",
|
|
1048
|
+
default: "localhost"
|
|
1049
|
+
},
|
|
1050
|
+
/**
|
|
1051
|
+
* port of automation driver
|
|
1052
|
+
*/
|
|
1053
|
+
port: {
|
|
1054
|
+
type: "number"
|
|
1055
|
+
},
|
|
1056
|
+
/**
|
|
1057
|
+
* path to WebDriver endpoints
|
|
1058
|
+
*/
|
|
1059
|
+
path: {
|
|
1060
|
+
type: "string",
|
|
1061
|
+
validate: (path2) => {
|
|
1062
|
+
if (!path2.startsWith("/")) {
|
|
1063
|
+
throw new TypeError('The option "path" needs to start with a "/"');
|
|
1064
|
+
}
|
|
1065
|
+
return true;
|
|
1066
|
+
},
|
|
1067
|
+
default: "/"
|
|
1068
|
+
},
|
|
1069
|
+
/**
|
|
1070
|
+
* A key-value store of query parameters to be added to every selenium request
|
|
1071
|
+
*/
|
|
1072
|
+
queryParams: {
|
|
1073
|
+
type: "object"
|
|
1074
|
+
},
|
|
1075
|
+
/**
|
|
1076
|
+
* cloud user if applicable
|
|
1077
|
+
*/
|
|
1078
|
+
user: {
|
|
1079
|
+
type: "string"
|
|
1080
|
+
},
|
|
1081
|
+
/**
|
|
1082
|
+
* access key to user
|
|
1083
|
+
*/
|
|
1084
|
+
key: {
|
|
1085
|
+
type: "string"
|
|
1086
|
+
},
|
|
1087
|
+
/**
|
|
1088
|
+
* capability of WebDriver session
|
|
1089
|
+
*/
|
|
1090
|
+
capabilities: {
|
|
1091
|
+
type: "object",
|
|
1092
|
+
required: true
|
|
1093
|
+
},
|
|
1094
|
+
/**
|
|
1095
|
+
* Level of logging verbosity
|
|
1096
|
+
*/
|
|
1097
|
+
logLevel: {
|
|
1098
|
+
type: "string",
|
|
1099
|
+
default: "info",
|
|
1100
|
+
match: /(trace|debug|info|warn|error|silent)/
|
|
1101
|
+
},
|
|
1102
|
+
/**
|
|
1103
|
+
* directory for log files
|
|
1104
|
+
*/
|
|
1105
|
+
outputDir: {
|
|
1106
|
+
type: "string"
|
|
1107
|
+
},
|
|
1108
|
+
/**
|
|
1109
|
+
* Timeout for any WebDriver request to a driver or grid
|
|
1110
|
+
*/
|
|
1111
|
+
connectionRetryTimeout: {
|
|
1112
|
+
type: "number",
|
|
1113
|
+
default: 12e4
|
|
1114
|
+
},
|
|
1115
|
+
/**
|
|
1116
|
+
* Count of request retries to the Selenium server
|
|
1117
|
+
*/
|
|
1118
|
+
connectionRetryCount: {
|
|
1119
|
+
type: "number",
|
|
1120
|
+
default: 3
|
|
1121
|
+
},
|
|
1122
|
+
/**
|
|
1123
|
+
* Override default agent
|
|
1124
|
+
*/
|
|
1125
|
+
logLevels: {
|
|
1126
|
+
type: "object"
|
|
1127
|
+
},
|
|
1128
|
+
/**
|
|
1129
|
+
* Pass custom headers
|
|
1130
|
+
*/
|
|
1131
|
+
headers: {
|
|
1132
|
+
type: "object"
|
|
1133
|
+
},
|
|
1134
|
+
/**
|
|
1135
|
+
* Function transforming the request options before the request is made
|
|
1136
|
+
*/
|
|
1137
|
+
transformRequest: {
|
|
1138
|
+
type: "function",
|
|
1139
|
+
default: (requestOptions) => requestOptions
|
|
1140
|
+
},
|
|
1141
|
+
/**
|
|
1142
|
+
* Function transforming the response object after it is received
|
|
1143
|
+
*/
|
|
1144
|
+
transformResponse: {
|
|
1145
|
+
type: "function",
|
|
1146
|
+
default: (response) => response
|
|
1147
|
+
},
|
|
1148
|
+
/**
|
|
1149
|
+
* Appium direct connect options server (https://appiumpro.com/editions/86-connecting-directly-to-appium-hosts-in-distributed-environments)
|
|
1150
|
+
* Whether to allow direct connect caps to adjust endpoint details (Appium only)
|
|
1151
|
+
*/
|
|
1152
|
+
enableDirectConnect: {
|
|
1153
|
+
type: "boolean",
|
|
1154
|
+
default: true
|
|
1155
|
+
},
|
|
1156
|
+
/**
|
|
1157
|
+
* Whether it requires SSL certificates to be valid in HTTP/s requests
|
|
1158
|
+
* for an environment which cannot get process environment well.
|
|
1159
|
+
*/
|
|
1160
|
+
strictSSL: {
|
|
1161
|
+
type: "boolean",
|
|
1162
|
+
default: true
|
|
1163
|
+
},
|
|
1164
|
+
/**
|
|
1165
|
+
* The path to the root of the cache directory. This directory is used to store all drivers that are downloaded
|
|
1166
|
+
* when attempting to start a session.
|
|
1167
|
+
*/
|
|
1168
|
+
cacheDir: {
|
|
1169
|
+
type: "string",
|
|
1170
|
+
default: process.env.WEBDRIVER_CACHE_DIR || os.tmpdir()
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
var ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
|
|
1174
|
+
var SHADOW_ELEMENT_KEY = "shadow-6066-11e4-a52e-4f735466cecf";
|
|
1175
|
+
|
|
1142
1176
|
// package.json
|
|
1143
1177
|
var package_default = {
|
|
1144
1178
|
name: "webdriver",
|
|
1145
|
-
version: "9.
|
|
1179
|
+
version: "9.1.1",
|
|
1146
1180
|
description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
1147
1181
|
author: "Christian Bromann <mail@bromann.dev>",
|
|
1148
1182
|
homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -1192,11 +1226,6 @@ var ERRORS_TO_EXCLUDE_FROM_RETRY = [
|
|
|
1192
1226
|
"detached shadow root",
|
|
1193
1227
|
"move target out of bounds"
|
|
1194
1228
|
];
|
|
1195
|
-
var RequestLibError = class extends Error {
|
|
1196
|
-
statusCode;
|
|
1197
|
-
body;
|
|
1198
|
-
code;
|
|
1199
|
-
};
|
|
1200
1229
|
var COMMANDS_WITHOUT_RETRY = [
|
|
1201
1230
|
findCommandPathByName("performActions")
|
|
1202
1231
|
];
|
|
@@ -1288,9 +1317,9 @@ var WebDriverRequest = class extends EventEmitter {
|
|
|
1288
1317
|
if (this.#requestTimeout) {
|
|
1289
1318
|
clearTimeout(this.#requestTimeout);
|
|
1290
1319
|
}
|
|
1291
|
-
const retry = (error2
|
|
1320
|
+
const retry = (error2) => {
|
|
1292
1321
|
if (retryCount >= totalRetryCount || error2.message.includes("invalid session id")) {
|
|
1293
|
-
log3.error(
|
|
1322
|
+
log3.error(error2.message);
|
|
1294
1323
|
this.emit("response", { error: error2 });
|
|
1295
1324
|
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
|
|
1296
1325
|
throw error2;
|
|
@@ -1298,19 +1327,14 @@ var WebDriverRequest = class extends EventEmitter {
|
|
|
1298
1327
|
++retryCount;
|
|
1299
1328
|
this.emit("retry", { error: error2, retryCount });
|
|
1300
1329
|
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
|
|
1301
|
-
log3.warn(
|
|
1330
|
+
log3.warn(error2.message);
|
|
1302
1331
|
log3.info(`Retrying ${retryCount}/${totalRetryCount}`);
|
|
1303
1332
|
return this._request(url, fullRequestOptions, transformResponse, totalRetryCount, retryCount);
|
|
1304
1333
|
};
|
|
1305
1334
|
if (response instanceof Error) {
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
return retry(
|
|
1309
|
-
}
|
|
1310
|
-
const statusCode = response.statusCode;
|
|
1311
|
-
if (statusCode && RETRYABLE_STATUS_CODES.includes(statusCode)) {
|
|
1312
|
-
const error2 = getRequestError(response, fullRequestOptions, url);
|
|
1313
|
-
return retry(error2, "Request failed with status code " + statusCode);
|
|
1335
|
+
const resError = response;
|
|
1336
|
+
if (resError.code && RETRYABLE_ERROR_CODES.includes(resError.code) || resError.statusCode && RETRYABLE_STATUS_CODES.includes(resError.statusCode)) {
|
|
1337
|
+
return retry(resError);
|
|
1314
1338
|
}
|
|
1315
1339
|
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
|
|
1316
1340
|
throw response;
|
|
@@ -1318,10 +1342,12 @@ var WebDriverRequest = class extends EventEmitter {
|
|
|
1318
1342
|
if (typeof transformResponse === "function") {
|
|
1319
1343
|
response = transformResponse(response, fullRequestOptions);
|
|
1320
1344
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1345
|
+
if (isSuccessfulResponse(response.statusCode, response.body)) {
|
|
1346
|
+
this.emit("response", { result: response.body });
|
|
1347
|
+
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
|
|
1348
|
+
return response.body;
|
|
1324
1349
|
}
|
|
1350
|
+
const error = new WebDriverResponseError(response, url, fullRequestOptions);
|
|
1325
1351
|
if (this.isHubCommand) {
|
|
1326
1352
|
if (typeof response.body === "string" && response.body.startsWith("<!DOCTYPE html>")) {
|
|
1327
1353
|
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
|
|
@@ -1329,11 +1355,6 @@ var WebDriverRequest = class extends EventEmitter {
|
|
|
1329
1355
|
}
|
|
1330
1356
|
return { value: response.body || null };
|
|
1331
1357
|
}
|
|
1332
|
-
if (isSuccessfulResponse(response.statusCode, response.body)) {
|
|
1333
|
-
this.emit("response", { result: response.body });
|
|
1334
|
-
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
|
|
1335
|
-
return response.body;
|
|
1336
|
-
}
|
|
1337
1358
|
if (error.name === "stale element reference") {
|
|
1338
1359
|
log3.warn("Request encountered a stale element - terminating request");
|
|
1339
1360
|
this.emit("response", { error });
|
|
@@ -1343,7 +1364,7 @@ var WebDriverRequest = class extends EventEmitter {
|
|
|
1343
1364
|
if (ERRORS_TO_EXCLUDE_FROM_RETRY.includes(error.name)) {
|
|
1344
1365
|
throw error;
|
|
1345
1366
|
}
|
|
1346
|
-
return retry(error
|
|
1367
|
+
return retry(error);
|
|
1347
1368
|
}
|
|
1348
1369
|
};
|
|
1349
1370
|
function findCommandPathByName(commandName) {
|
|
@@ -1381,9 +1402,13 @@ var FetchRequest = class extends WebDriverRequest {
|
|
|
1381
1402
|
};
|
|
1382
1403
|
} catch (err) {
|
|
1383
1404
|
if (!(err instanceof Error)) {
|
|
1384
|
-
throw new
|
|
1405
|
+
throw new WebDriverRequestError(
|
|
1406
|
+
new Error(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`),
|
|
1407
|
+
url,
|
|
1408
|
+
opts
|
|
1409
|
+
);
|
|
1385
1410
|
}
|
|
1386
|
-
throw err;
|
|
1411
|
+
throw new WebDriverRequestError(err, url, opts);
|
|
1387
1412
|
}
|
|
1388
1413
|
}
|
|
1389
1414
|
_libPerformanceNow() {
|
|
@@ -1629,7 +1654,6 @@ export {
|
|
|
1629
1654
|
BidiHandler,
|
|
1630
1655
|
DEFAULTS,
|
|
1631
1656
|
ELEMENT_KEY,
|
|
1632
|
-
REG_EXPS,
|
|
1633
1657
|
SHADOW_ELEMENT_KEY,
|
|
1634
1658
|
command_default as command,
|
|
1635
1659
|
WebDriver as default,
|
|
@@ -2,4 +2,12 @@
|
|
|
2
2
|
* retrieved from https://github.com/sindresorhus/ky/blob/3ba40cc6333cf1847c02c51744e22ab7c04407f5/source/utils/normalize.ts#L10
|
|
3
3
|
*/
|
|
4
4
|
export declare const RETRYABLE_STATUS_CODES: number[];
|
|
5
|
+
/**
|
|
6
|
+
* retrieved from https://github.com/sindresorhus/got/blob/89b7fdfd4e7ea4e76258f50b70ae8a1d2aea8125/source/core/options.ts#L392C1-L399C37
|
|
7
|
+
*/
|
|
8
|
+
export declare const RETRYABLE_ERROR_CODES: string[];
|
|
9
|
+
export declare const REG_EXPS: {
|
|
10
|
+
commandName: RegExp;
|
|
11
|
+
execFn: RegExp;
|
|
12
|
+
};
|
|
5
13
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/request/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,sBAAsB,UAAsC,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/request/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,sBAAsB,UAAsC,CAAA;AACzE;;GAEG;AACH,eAAO,MAAM,qBAAqB,UAKjC,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Options } from '@wdio/types';
|
|
2
|
+
declare abstract class WebDriverError extends Error {
|
|
3
|
+
#private;
|
|
4
|
+
abstract url: URL;
|
|
5
|
+
abstract opts: RequestInit;
|
|
6
|
+
/**
|
|
7
|
+
* return timeout error with information about the executing command on which the test hangs
|
|
8
|
+
*/
|
|
9
|
+
computeErrorMessage(): string;
|
|
10
|
+
}
|
|
11
|
+
export declare class WebDriverRequestError extends WebDriverError {
|
|
12
|
+
url: URL;
|
|
13
|
+
opts: RequestInit;
|
|
14
|
+
statusCode?: number;
|
|
15
|
+
body?: any;
|
|
16
|
+
code?: string;
|
|
17
|
+
constructor(err: Error, url: URL, opts: RequestInit);
|
|
18
|
+
}
|
|
19
|
+
export declare class WebDriverResponseError extends WebDriverError {
|
|
20
|
+
url: URL;
|
|
21
|
+
opts: RequestInit;
|
|
22
|
+
constructor(response: Options.RequestLibResponse, url: URL, opts: RequestInit);
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/request/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG1C,uBAAe,cAAe,SAAQ,KAAK;;IACvC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;IACjB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAE1B;;OAEG;IACH,mBAAmB;CAsCtB;AAED,qBAAa,qBAAsB,SAAQ,cAAc;IACrD,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,WAAW,CAAA;IAEjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;gBAEA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW;CAwBvD;AAED,qBAAa,sBAAuB,SAAQ,cAAc;IACtD,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,WAAW,CAAA;gBACJ,QAAQ,EAAE,OAAO,CAAC,kBAAkB,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW;CAyDjF"}
|
package/build/request/index.d.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { URL } from 'node:url';
|
|
3
3
|
import type { Options } from '@wdio/types';
|
|
4
|
+
import type { WebDriverResponse } from './types.js';
|
|
4
5
|
type RequestLibResponse = Options.RequestLibResponse;
|
|
5
6
|
type RequestOptions = Omit<Options.WebDriver, 'capabilities'>;
|
|
6
|
-
export declare class RequestLibError extends Error {
|
|
7
|
-
statusCode?: number;
|
|
8
|
-
body?: any;
|
|
9
|
-
code?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface WebDriverResponse {
|
|
12
|
-
value: any;
|
|
13
|
-
/**
|
|
14
|
-
* error case
|
|
15
|
-
* https://w3c.github.io/webdriver/webdriver-spec.html#dfn-send-an-error
|
|
16
|
-
*/
|
|
17
|
-
error?: string;
|
|
18
|
-
message?: string;
|
|
19
|
-
stacktrace?: string;
|
|
20
|
-
/**
|
|
21
|
-
* JSONWP property
|
|
22
|
-
*/
|
|
23
|
-
status?: number;
|
|
24
|
-
sessionId?: string;
|
|
25
|
-
}
|
|
26
7
|
export declare const COMMANDS_WITHOUT_RETRY: string[];
|
|
27
8
|
export default abstract class WebDriverRequest extends EventEmitter {
|
|
28
9
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAMnD,KAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACpD,KAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAO7D,eAAO,MAAM,sBAAsB,UAElC,CAAA;AAWD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ,YAAY;;IAG/D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,EAAE,OAAO,CAAA;gBAEb,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;IAStG,WAAW,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM;cAc9C,cAAc,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC;QAAC,GAAG,EAAE,GAAG,CAAC;QAAC,cAAc,EAAE,WAAW,CAAC;KAAC,CAAC;cA0D3I,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIxF,SAAS,CAAC,kBAAkB,IAAI,MAAM;YAIxB,QAAQ;CA4HzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,gBAAgB,MAAM,YAAY,CAAA;AASzC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;gBACzC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;cAI5F,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;IA6B9F,SAAS,CAAC,kBAAkB,IAAI,MAAM;CAGzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WebDriverResponse {
|
|
2
|
+
value: any;
|
|
3
|
+
/**
|
|
4
|
+
* error case
|
|
5
|
+
* https://w3c.github.io/webdriver/webdriver-spec.html#dfn-send-an-error
|
|
6
|
+
*/
|
|
7
|
+
error?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
stacktrace?: string;
|
|
10
|
+
/**
|
|
11
|
+
* JSONWP property
|
|
12
|
+
*/
|
|
13
|
+
status?: number;
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,GAAG,CAAA;IACV;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB"}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EventEmitter } from 'node:events';
|
|
2
2
|
import type { Options } from '@wdio/types';
|
|
3
|
-
import type { WebDriverResponse } from './request/
|
|
3
|
+
import type { WebDriverResponse } from './request/types.js';
|
|
4
4
|
import type { Client, JSONWPCommandError, SessionFlags, RemoteConfig } from './types.js';
|
|
5
5
|
/**
|
|
6
6
|
* start browser session with WebDriver protocol
|
|
@@ -27,15 +27,6 @@ export declare function isSuccessfulResponse(statusCode?: number, body?: WebDriv
|
|
|
27
27
|
* creates the base prototype for the webdriver monad
|
|
28
28
|
*/
|
|
29
29
|
export declare function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSeleniumStandalone }: Partial<SessionFlags>): Record<string, PropertyDescriptor>;
|
|
30
|
-
/**
|
|
31
|
-
* helper method to determine the error from webdriver response
|
|
32
|
-
* @param {Object} body body object
|
|
33
|
-
* @return {Object} error
|
|
34
|
-
*/
|
|
35
|
-
export declare function getErrorFromResponseBody(body: any, requestOptions: any): Error;
|
|
36
|
-
export declare class CustomRequestError extends Error {
|
|
37
|
-
constructor(body: WebDriverResponse, requestOptions: any);
|
|
38
|
-
}
|
|
39
30
|
/**
|
|
40
31
|
* return all supported flags and return them in a format so we can attach them
|
|
41
32
|
* to the instance protocol
|
|
@@ -55,10 +46,6 @@ export declare function setupDirectConnect(client: Client): void;
|
|
|
55
46
|
* @param {Error} err response error
|
|
56
47
|
*/
|
|
57
48
|
export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string;
|
|
58
|
-
/**
|
|
59
|
-
* return timeout error with information about the executing command on which the test hangs
|
|
60
|
-
*/
|
|
61
|
-
export declare function getRequestError(error: Error, requestOptions: RequestInit, url: URL): Error;
|
|
62
49
|
/**
|
|
63
50
|
* Enhance the monad with WebDriver Bidi primitives if a connection can be established successfully
|
|
64
51
|
* @param socketUrl url to bidi interface
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAU/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAI3D,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAYxF;;GAEG;AACH,wBAAsB,qBAAqB,CAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,WAAW,CAAC,YAAY,CAAA;CAAE,CAAC,CAyDzI;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAE,YAAY,EAAE,WAAW,CAAC,YAAY,QAiC3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAE,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,iBAAiB,WA4DlF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,sCA8C7H;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,qBAAqB,CAYpL;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,QAgBhD;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,kBAAkB,WAAU,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,WAmD1F,CAAA;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAAG,qBAAqB,CAejG;AAED,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAWjE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriver",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@types/node": "^20.1.0",
|
|
37
37
|
"@types/ws": "^8.5.3",
|
|
38
|
-
"@wdio/config": "9.1.
|
|
38
|
+
"@wdio/config": "9.1.2",
|
|
39
39
|
"@wdio/logger": "9.1.0",
|
|
40
40
|
"@wdio/protocols": "9.0.8",
|
|
41
|
-
"@wdio/types": "9.1.
|
|
42
|
-
"@wdio/utils": "9.1.
|
|
41
|
+
"@wdio/types": "9.1.2",
|
|
42
|
+
"@wdio/utils": "9.1.2",
|
|
43
43
|
"deepmerge-ts": "^7.0.3",
|
|
44
44
|
"ws": "^8.8.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "e009b5102f9f98b99fa62df870ce7f3f5bc1b99a"
|
|
47
47
|
}
|