webdriver 9.0.8 → 9.1.1
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/index.js
CHANGED
|
@@ -22,6 +22,19 @@ import { URL } from "node:url";
|
|
|
22
22
|
import logger3 from "@wdio/logger";
|
|
23
23
|
import { transformCommandLogResult as transformCommandLogResult2 } from "@wdio/utils";
|
|
24
24
|
|
|
25
|
+
// src/request/constants.ts
|
|
26
|
+
var RETRYABLE_STATUS_CODES = [408, 413, 429, 500, 502, 503, 504];
|
|
27
|
+
var RETRYABLE_ERROR_CODES = [
|
|
28
|
+
"ETIMEDOUT",
|
|
29
|
+
"ECONNRESET",
|
|
30
|
+
"EADDRINUSE",
|
|
31
|
+
"ECONNREFUSED",
|
|
32
|
+
"EPIPE",
|
|
33
|
+
"ENOTFOUND",
|
|
34
|
+
"ENETUNREACH",
|
|
35
|
+
"EAI_AGAIN"
|
|
36
|
+
];
|
|
37
|
+
|
|
25
38
|
// src/utils.ts
|
|
26
39
|
import { deepmergeCustom } from "deepmerge-ts";
|
|
27
40
|
import logger2 from "@wdio/logger";
|
|
@@ -875,20 +888,23 @@ var BROWSER_DRIVER_ERRORS = [
|
|
|
875
888
|
// iedriver
|
|
876
889
|
];
|
|
877
890
|
async function startWebDriverSession(params) {
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
|
|
891
|
+
const capabilities = params.capabilities && "alwaysMatch" in params.capabilities ? params.capabilities : { alwaysMatch: params.capabilities, firstMatch: [{}] };
|
|
892
|
+
if (
|
|
893
|
+
/**
|
|
894
|
+
* except, if user does not want to opt-in
|
|
895
|
+
*/
|
|
896
|
+
!capabilities.alwaysMatch["wdio:enforceWebDriverClassic"] && /**
|
|
897
|
+
* or user requests a Safari session which does not support Bidi
|
|
898
|
+
*/
|
|
899
|
+
typeof capabilities.alwaysMatch.browserName === "string" && capabilities.alwaysMatch.browserName.toLowerCase() !== "safari"
|
|
900
|
+
) {
|
|
901
|
+
capabilities.alwaysMatch.webSocketUrl = true;
|
|
881
902
|
}
|
|
882
|
-
validateCapabilities(
|
|
903
|
+
validateCapabilities(capabilities.alwaysMatch);
|
|
883
904
|
const sessionRequest = new FetchRequest(
|
|
884
905
|
"POST",
|
|
885
906
|
"/session",
|
|
886
|
-
{
|
|
887
|
-
capabilities: w3cCaps,
|
|
888
|
-
// W3C compliant
|
|
889
|
-
desiredCapabilities: jsonwpCaps
|
|
890
|
-
// JSONWP compliant
|
|
891
|
-
}
|
|
907
|
+
{ capabilities }
|
|
892
908
|
);
|
|
893
909
|
let response;
|
|
894
910
|
try {
|
|
@@ -1078,7 +1094,7 @@ It seems like the service failed to start or is rejecting any connections.`;
|
|
|
1078
1094
|
}
|
|
1079
1095
|
return err.message;
|
|
1080
1096
|
};
|
|
1081
|
-
function
|
|
1097
|
+
function getRequestError(error, requestOptions, url) {
|
|
1082
1098
|
const cmdName = getExecCmdName(url);
|
|
1083
1099
|
const cmdArgs = getExecCmdArgs(requestOptions);
|
|
1084
1100
|
const cmdInfoMsg = `when running "${cmdName}" with method "${requestOptions.method}"`;
|
|
@@ -1136,7 +1152,7 @@ function parseBidiMessage(data) {
|
|
|
1136
1152
|
// package.json
|
|
1137
1153
|
var package_default = {
|
|
1138
1154
|
name: "webdriver",
|
|
1139
|
-
version: "9.0
|
|
1155
|
+
version: "9.1.0",
|
|
1140
1156
|
description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
1141
1157
|
author: "Christian Bromann <mail@bromann.dev>",
|
|
1142
1158
|
homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -1297,10 +1313,16 @@ var WebDriverRequest = class extends EventEmitter {
|
|
|
1297
1313
|
return this._request(url, fullRequestOptions, transformResponse, totalRetryCount, retryCount);
|
|
1298
1314
|
};
|
|
1299
1315
|
if (response instanceof Error) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1316
|
+
const errorCode = response.code;
|
|
1317
|
+
if (errorCode && RETRYABLE_ERROR_CODES.includes(errorCode)) {
|
|
1318
|
+
const error2 = getRequestError(response, fullRequestOptions, url);
|
|
1302
1319
|
return retry(error2, 'Request timed out! Consider increasing the "connectionRetryTimeout" option.');
|
|
1303
1320
|
}
|
|
1321
|
+
const statusCode = response.statusCode;
|
|
1322
|
+
if (statusCode && RETRYABLE_STATUS_CODES.includes(statusCode)) {
|
|
1323
|
+
const error2 = getRequestError(response, fullRequestOptions, url);
|
|
1324
|
+
return retry(error2, "Request failed with status code " + statusCode);
|
|
1325
|
+
}
|
|
1304
1326
|
this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
|
|
1305
1327
|
throw response;
|
|
1306
1328
|
}
|
|
@@ -1513,7 +1535,7 @@ var WebDriver = class _WebDriver {
|
|
|
1513
1535
|
capabilities["wdio:driverPID"] = driverProcess.pid;
|
|
1514
1536
|
}
|
|
1515
1537
|
const bidiPrototype = {};
|
|
1516
|
-
if (isBidi(capabilities)) {
|
|
1538
|
+
if (isBidi(requestedCapabilities, capabilities)) {
|
|
1517
1539
|
log5.info(`Register BiDi handler for session with id ${sessionId}`);
|
|
1518
1540
|
Object.assign(bidiPrototype, initiateBidi(capabilities.webSocketUrl, options.strictSSL));
|
|
1519
1541
|
}
|
|
@@ -1528,9 +1550,9 @@ var WebDriver = class _WebDriver {
|
|
|
1528
1550
|
}
|
|
1529
1551
|
);
|
|
1530
1552
|
const client = monad(sessionId, customCommandWrapper);
|
|
1531
|
-
if (isBidi(capabilities)) {
|
|
1553
|
+
if (isBidi(requestedCapabilities, capabilities)) {
|
|
1532
1554
|
await client._bidiHandler.connect();
|
|
1533
|
-
client._bidiHandler
|
|
1555
|
+
client._bidiHandler.socket.on("message", parseBidiMessage.bind(client));
|
|
1534
1556
|
}
|
|
1535
1557
|
if (params.enableDirectConnect) {
|
|
1536
1558
|
setupDirectConnect(client);
|
|
@@ -1558,7 +1580,7 @@ var WebDriver = class _WebDriver {
|
|
|
1558
1580
|
const environmentPrototype = getEnvironmentVars(options);
|
|
1559
1581
|
const protocolCommands = getPrototype(options);
|
|
1560
1582
|
const bidiPrototype = {};
|
|
1561
|
-
if (isBidi(options.capabilities)) {
|
|
1583
|
+
if (isBidi(options.requestedCapabilities || {}, options.capabilities || {})) {
|
|
1562
1584
|
const webSocketUrl = options.capabilities?.webSocketUrl;
|
|
1563
1585
|
log5.info(`Register BiDi handler for session with id ${options.sessionId}`);
|
|
1564
1586
|
Object.assign(bidiPrototype, initiateBidi(webSocketUrl, options.strictSSL));
|
|
@@ -1566,7 +1588,7 @@ var WebDriver = class _WebDriver {
|
|
|
1566
1588
|
const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype, ...bidiPrototype };
|
|
1567
1589
|
const monad = webdriverMonad(options, modifier, prototype);
|
|
1568
1590
|
const client = monad(options.sessionId, commandWrapper);
|
|
1569
|
-
if (isBidi(options.capabilities)) {
|
|
1591
|
+
if (isBidi(options.requestedCapabilities || {}, options.capabilities || {})) {
|
|
1570
1592
|
client._bidiHandler?.socket.on("message", parseBidiMessage.bind(client));
|
|
1571
1593
|
}
|
|
1572
1594
|
return client;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* retrieved from https://github.com/sindresorhus/ky/blob/3ba40cc6333cf1847c02c51744e22ab7c04407f5/source/utils/normalize.ts#L10
|
|
3
|
+
*/
|
|
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
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,UAGjC,CAAA"}
|
|
@@ -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;AAO1C,KAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACpD,KAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAO7D,qBAAa,eAAgB,SAAQ,KAAK;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,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;AAED,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;CAsIzB"}
|
package/build/utils.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare const getSessionError: (err: JSONWPCommandError, params?: Partial
|
|
|
58
58
|
/**
|
|
59
59
|
* return timeout error with information about the executing command on which the test hangs
|
|
60
60
|
*/
|
|
61
|
-
export declare function
|
|
61
|
+
export declare function getRequestError(error: Error, requestOptions: RequestInit, url: URL): Error;
|
|
62
62
|
/**
|
|
63
63
|
* Enhance the monad with WebDriver Bidi primitives if a connection can be established successfully
|
|
64
64
|
* @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;AAW/C,OA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IG;AACH,wBAAgB,wBAAwB,CAAE,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,SAcvE;AAGD,qBAAa,kBAAmB,SAAQ,KAAK;gBAC5B,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG;CA8C5D;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;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,GAAG,KAAK,CAS1F;AA+BD;;;;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.
|
|
3
|
+
"version": "9.1.1",
|
|
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.0
|
|
39
|
-
"@wdio/logger": "9.0
|
|
38
|
+
"@wdio/config": "9.1.0",
|
|
39
|
+
"@wdio/logger": "9.1.0",
|
|
40
40
|
"@wdio/protocols": "9.0.8",
|
|
41
|
-
"@wdio/types": "9.0
|
|
42
|
-
"@wdio/utils": "9.0
|
|
41
|
+
"@wdio/types": "9.1.0",
|
|
42
|
+
"@wdio/utils": "9.1.0",
|
|
43
43
|
"deepmerge-ts": "^7.0.3",
|
|
44
44
|
"ws": "^8.8.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "f70367e464d7c056328cd7d8e57ea296c0e766ae"
|
|
47
47
|
}
|