webdriver 9.0.4 → 9.0.6
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.cjs +1 -1
- package/build/index.js +29 -23
- package/build/utils.d.ts +7 -0
- package/build/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/build/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ var init_request = __esm({
|
|
|
60
60
|
};
|
|
61
61
|
} catch (err) {
|
|
62
62
|
if (!(err instanceof Error)) {
|
|
63
|
-
throw new import_index.RequestLibError(`Failed to fetch ${url.href}: ${err.message || err}`);
|
|
63
|
+
throw new import_index.RequestLibError(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`);
|
|
64
64
|
}
|
|
65
65
|
throw err;
|
|
66
66
|
}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import logger5 from "@wdio/logger";
|
|
3
|
-
import { webdriverMonad, sessionEnvironmentDetector, startWebDriver } from "@wdio/utils";
|
|
3
|
+
import { webdriverMonad, sessionEnvironmentDetector, startWebDriver, isBidi } from "@wdio/utils";
|
|
4
4
|
import { validateConfig } from "@wdio/config";
|
|
5
5
|
|
|
6
6
|
// src/command.ts
|
|
@@ -875,22 +875,11 @@ var BROWSER_DRIVER_ERRORS = [
|
|
|
875
875
|
// iedriver
|
|
876
876
|
];
|
|
877
877
|
async function startWebDriverSession(params) {
|
|
878
|
-
if (params.capabilities) {
|
|
879
|
-
const extensionCaps = Object.keys(params.capabilities).filter((cap) => cap.includes(":"));
|
|
880
|
-
const invalidWebDriverCaps = Object.keys(params.capabilities).filter((cap) => !CAPABILITY_KEYS.includes(cap) && !cap.includes(":"));
|
|
881
|
-
if (extensionCaps.length && invalidWebDriverCaps.length) {
|
|
882
|
-
throw new Error(
|
|
883
|
-
`Invalid or unsupported WebDriver capabilities found ("${invalidWebDriverCaps.join('", "')}"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to your vendor support team if you have further questions.`
|
|
884
|
-
);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
878
|
const [w3cCaps, jsonwpCaps] = params.capabilities && "alwaysMatch" in params.capabilities ? [params.capabilities, params.capabilities.alwaysMatch] : [{ alwaysMatch: params.capabilities, firstMatch: [{}] }, params.capabilities];
|
|
888
|
-
if (!w3cCaps.alwaysMatch["wdio:enforceWebDriverClassic"] && typeof w3cCaps.alwaysMatch.browserName === "string" && w3cCaps.alwaysMatch.browserName !== "safari") {
|
|
879
|
+
if (!w3cCaps.alwaysMatch["wdio:enforceWebDriverClassic"] && typeof w3cCaps.alwaysMatch.browserName === "string" && w3cCaps.alwaysMatch.browserName.toLowerCase() !== "safari") {
|
|
889
880
|
w3cCaps.alwaysMatch.webSocketUrl = true;
|
|
890
881
|
}
|
|
891
|
-
|
|
892
|
-
jsonwpCaps.webSocketUrl = true;
|
|
893
|
-
}
|
|
882
|
+
validateCapabilities(w3cCaps.alwaysMatch);
|
|
894
883
|
const sessionRequest = new FetchRequest(
|
|
895
884
|
"POST",
|
|
896
885
|
"/session",
|
|
@@ -913,6 +902,23 @@ async function startWebDriverSession(params) {
|
|
|
913
902
|
params.capabilities = response.value.capabilities || response.value;
|
|
914
903
|
return { sessionId, capabilities: params.capabilities };
|
|
915
904
|
}
|
|
905
|
+
function validateCapabilities(capabilities) {
|
|
906
|
+
const chromeArgs = capabilities["goog:chromeOptions"]?.args || [];
|
|
907
|
+
if (chromeArgs.includes("incognito") || chromeArgs.includes("--incognito")) {
|
|
908
|
+
throw new Error(
|
|
909
|
+
'Please remove "incognito" from `"goog:chromeOptions".args` as it is not supported running Chrome with WebDriver. WebDriver sessions are always incognito mode and do not persist across browser sessions.'
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
if (capabilities) {
|
|
913
|
+
const extensionCaps = Object.keys(capabilities).filter((cap) => cap.includes(":"));
|
|
914
|
+
const invalidWebDriverCaps = Object.keys(capabilities).filter((cap) => !CAPABILITY_KEYS.includes(cap) && !cap.includes(":"));
|
|
915
|
+
if (extensionCaps.length && invalidWebDriverCaps.length) {
|
|
916
|
+
throw new Error(
|
|
917
|
+
`Invalid or unsupported WebDriver capabilities found ("${invalidWebDriverCaps.join('", "')}"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to your vendor support team if you have further questions.`
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
916
922
|
function isSuccessfulResponse(statusCode, body) {
|
|
917
923
|
if (!body || typeof body.value === "undefined") {
|
|
918
924
|
log2.debug("request failed due to missing body");
|
|
@@ -1013,7 +1019,7 @@ var CustomRequestError = class _CustomRequestError extends Error {
|
|
|
1013
1019
|
Error.captureStackTrace(this, _CustomRequestError);
|
|
1014
1020
|
}
|
|
1015
1021
|
};
|
|
1016
|
-
function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi, isChromium }) {
|
|
1022
|
+
function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi: isBidi2, isChromium }) {
|
|
1017
1023
|
return {
|
|
1018
1024
|
isW3C: { value: isW3C },
|
|
1019
1025
|
isMobile: { value: isMobile },
|
|
@@ -1022,7 +1028,7 @@ function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSa
|
|
|
1022
1028
|
isFirefox: { value: isFirefox },
|
|
1023
1029
|
isSauce: { value: isSauce },
|
|
1024
1030
|
isSeleniumStandalone: { value: isSeleniumStandalone },
|
|
1025
|
-
isBidi: { value:
|
|
1031
|
+
isBidi: { value: isBidi2 },
|
|
1026
1032
|
isChromium: { value: isChromium }
|
|
1027
1033
|
};
|
|
1028
1034
|
}
|
|
@@ -1130,7 +1136,7 @@ function parseBidiMessage(data) {
|
|
|
1130
1136
|
// package.json
|
|
1131
1137
|
var package_default = {
|
|
1132
1138
|
name: "webdriver",
|
|
1133
|
-
version: "9.0.
|
|
1139
|
+
version: "9.0.5",
|
|
1134
1140
|
description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
1135
1141
|
author: "Christian Bromann <mail@bromann.dev>",
|
|
1136
1142
|
homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -1364,7 +1370,7 @@ var FetchRequest = class extends WebDriverRequest {
|
|
|
1364
1370
|
};
|
|
1365
1371
|
} catch (err) {
|
|
1366
1372
|
if (!(err instanceof Error)) {
|
|
1367
|
-
throw new RequestLibError(`Failed to fetch ${url.href}: ${err.message || err}`);
|
|
1373
|
+
throw new RequestLibError(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`);
|
|
1368
1374
|
}
|
|
1369
1375
|
throw err;
|
|
1370
1376
|
}
|
|
@@ -1507,7 +1513,7 @@ var WebDriver = class _WebDriver {
|
|
|
1507
1513
|
capabilities["wdio:driverPID"] = driverProcess.pid;
|
|
1508
1514
|
}
|
|
1509
1515
|
const bidiPrototype = {};
|
|
1510
|
-
if (capabilities
|
|
1516
|
+
if (isBidi(capabilities)) {
|
|
1511
1517
|
log5.info(`Register BiDi handler for session with id ${sessionId}`);
|
|
1512
1518
|
Object.assign(bidiPrototype, initiateBidi(capabilities.webSocketUrl, options.strictSSL));
|
|
1513
1519
|
}
|
|
@@ -1522,7 +1528,7 @@ var WebDriver = class _WebDriver {
|
|
|
1522
1528
|
}
|
|
1523
1529
|
);
|
|
1524
1530
|
const client = monad(sessionId, customCommandWrapper);
|
|
1525
|
-
if (capabilities
|
|
1531
|
+
if (isBidi(capabilities)) {
|
|
1526
1532
|
await client._bidiHandler.connect();
|
|
1527
1533
|
client._bidiHandler?.socket.on("message", parseBidiMessage.bind(client));
|
|
1528
1534
|
}
|
|
@@ -1552,15 +1558,15 @@ var WebDriver = class _WebDriver {
|
|
|
1552
1558
|
const environmentPrototype = getEnvironmentVars(options);
|
|
1553
1559
|
const protocolCommands = getPrototype(options);
|
|
1554
1560
|
const bidiPrototype = {};
|
|
1555
|
-
|
|
1556
|
-
|
|
1561
|
+
if (isBidi(options.capabilities)) {
|
|
1562
|
+
const webSocketUrl = options.capabilities?.webSocketUrl;
|
|
1557
1563
|
log5.info(`Register BiDi handler for session with id ${options.sessionId}`);
|
|
1558
1564
|
Object.assign(bidiPrototype, initiateBidi(webSocketUrl, options.strictSSL));
|
|
1559
1565
|
}
|
|
1560
1566
|
const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype, ...bidiPrototype };
|
|
1561
1567
|
const monad = webdriverMonad(options, modifier, prototype);
|
|
1562
1568
|
const client = monad(options.sessionId, commandWrapper);
|
|
1563
|
-
if (
|
|
1569
|
+
if (isBidi(options.capabilities)) {
|
|
1564
1570
|
client._bidiHandler?.socket.on("message", parseBidiMessage.bind(client));
|
|
1565
1571
|
}
|
|
1566
1572
|
return client;
|
package/build/utils.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export declare function startWebDriverSession(params: RemoteConfig): Promise<{
|
|
|
9
9
|
sessionId: string;
|
|
10
10
|
capabilities: WebdriverIO.Capabilities;
|
|
11
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
|
+
*/
|
|
18
|
+
export declare function validateCapabilities(capabilities: WebdriverIO.Capabilities): void;
|
|
12
19
|
/**
|
|
13
20
|
* check if WebDriver requests was successful
|
|
14
21
|
* @param {number} statusCode status code of request
|
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,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAO1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,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,
|
|
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,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAO1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,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,CAkDzI;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;;;;GAIG;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.0.
|
|
3
|
+
"version": "9.0.6",
|
|
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.
|
|
38
|
+
"@wdio/config": "9.0.6",
|
|
39
39
|
"@wdio/logger": "9.0.4",
|
|
40
40
|
"@wdio/protocols": "9.0.4",
|
|
41
41
|
"@wdio/types": "9.0.4",
|
|
42
|
-
"@wdio/utils": "9.0.
|
|
42
|
+
"@wdio/utils": "9.0.6",
|
|
43
43
|
"deepmerge-ts": "^7.0.3",
|
|
44
44
|
"ws": "^8.8.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5dff8a8ea887a7d8df0f7faaa5ef6ae7d98dff83"
|
|
47
47
|
}
|