webdriver 9.0.0 → 9.0.5
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 +28 -19
- package/build/utils.d.ts +7 -0
- package/build/utils.d.ts.map +1 -1
- package/package.json +8 -8
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,15 +875,6 @@ 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
879
|
if (!w3cCaps.alwaysMatch["wdio:enforceWebDriverClassic"] && typeof w3cCaps.alwaysMatch.browserName === "string" && w3cCaps.alwaysMatch.browserName !== "safari") {
|
|
889
880
|
w3cCaps.alwaysMatch.webSocketUrl = true;
|
|
@@ -891,6 +882,7 @@ async function startWebDriverSession(params) {
|
|
|
891
882
|
if (!jsonwpCaps["wdio:enforceWebDriverClassic"] && typeof jsonwpCaps.browserName === "string" && jsonwpCaps.browserName !== "safari") {
|
|
892
883
|
jsonwpCaps.webSocketUrl = true;
|
|
893
884
|
}
|
|
885
|
+
validateCapabilities(w3cCaps.alwaysMatch);
|
|
894
886
|
const sessionRequest = new FetchRequest(
|
|
895
887
|
"POST",
|
|
896
888
|
"/session",
|
|
@@ -913,6 +905,23 @@ async function startWebDriverSession(params) {
|
|
|
913
905
|
params.capabilities = response.value.capabilities || response.value;
|
|
914
906
|
return { sessionId, capabilities: params.capabilities };
|
|
915
907
|
}
|
|
908
|
+
function validateCapabilities(capabilities) {
|
|
909
|
+
const chromeArgs = capabilities["goog:chromeOptions"]?.args || [];
|
|
910
|
+
if (chromeArgs.includes("incognito") || chromeArgs.includes("--incognito")) {
|
|
911
|
+
throw new Error(
|
|
912
|
+
'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.'
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
if (capabilities) {
|
|
916
|
+
const extensionCaps = Object.keys(capabilities).filter((cap) => cap.includes(":"));
|
|
917
|
+
const invalidWebDriverCaps = Object.keys(capabilities).filter((cap) => !CAPABILITY_KEYS.includes(cap) && !cap.includes(":"));
|
|
918
|
+
if (extensionCaps.length && invalidWebDriverCaps.length) {
|
|
919
|
+
throw new Error(
|
|
920
|
+
`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.`
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
916
925
|
function isSuccessfulResponse(statusCode, body) {
|
|
917
926
|
if (!body || typeof body.value === "undefined") {
|
|
918
927
|
log2.debug("request failed due to missing body");
|
|
@@ -1013,7 +1022,7 @@ var CustomRequestError = class _CustomRequestError extends Error {
|
|
|
1013
1022
|
Error.captureStackTrace(this, _CustomRequestError);
|
|
1014
1023
|
}
|
|
1015
1024
|
};
|
|
1016
|
-
function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi, isChromium }) {
|
|
1025
|
+
function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi: isBidi2, isChromium }) {
|
|
1017
1026
|
return {
|
|
1018
1027
|
isW3C: { value: isW3C },
|
|
1019
1028
|
isMobile: { value: isMobile },
|
|
@@ -1022,7 +1031,7 @@ function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSa
|
|
|
1022
1031
|
isFirefox: { value: isFirefox },
|
|
1023
1032
|
isSauce: { value: isSauce },
|
|
1024
1033
|
isSeleniumStandalone: { value: isSeleniumStandalone },
|
|
1025
|
-
isBidi: { value:
|
|
1034
|
+
isBidi: { value: isBidi2 },
|
|
1026
1035
|
isChromium: { value: isChromium }
|
|
1027
1036
|
};
|
|
1028
1037
|
}
|
|
@@ -1130,7 +1139,7 @@ function parseBidiMessage(data) {
|
|
|
1130
1139
|
// package.json
|
|
1131
1140
|
var package_default = {
|
|
1132
1141
|
name: "webdriver",
|
|
1133
|
-
version: "9.0.
|
|
1142
|
+
version: "9.0.4",
|
|
1134
1143
|
description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
1135
1144
|
author: "Christian Bromann <mail@bromann.dev>",
|
|
1136
1145
|
homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -1153,7 +1162,7 @@ var package_default = {
|
|
|
1153
1162
|
},
|
|
1154
1163
|
repository: {
|
|
1155
1164
|
type: "git",
|
|
1156
|
-
url: "git://github.com/webdriverio/webdriverio.git",
|
|
1165
|
+
url: "git+https://github.com/webdriverio/webdriverio.git",
|
|
1157
1166
|
directory: "packages/webdriver"
|
|
1158
1167
|
},
|
|
1159
1168
|
keywords: [
|
|
@@ -1507,7 +1516,7 @@ var WebDriver = class _WebDriver {
|
|
|
1507
1516
|
capabilities["wdio:driverPID"] = driverProcess.pid;
|
|
1508
1517
|
}
|
|
1509
1518
|
const bidiPrototype = {};
|
|
1510
|
-
if (capabilities
|
|
1519
|
+
if (isBidi(capabilities)) {
|
|
1511
1520
|
log5.info(`Register BiDi handler for session with id ${sessionId}`);
|
|
1512
1521
|
Object.assign(bidiPrototype, initiateBidi(capabilities.webSocketUrl, options.strictSSL));
|
|
1513
1522
|
}
|
|
@@ -1522,7 +1531,7 @@ var WebDriver = class _WebDriver {
|
|
|
1522
1531
|
}
|
|
1523
1532
|
);
|
|
1524
1533
|
const client = monad(sessionId, customCommandWrapper);
|
|
1525
|
-
if (capabilities
|
|
1534
|
+
if (isBidi(capabilities)) {
|
|
1526
1535
|
await client._bidiHandler.connect();
|
|
1527
1536
|
client._bidiHandler?.socket.on("message", parseBidiMessage.bind(client));
|
|
1528
1537
|
}
|
|
@@ -1552,15 +1561,15 @@ var WebDriver = class _WebDriver {
|
|
|
1552
1561
|
const environmentPrototype = getEnvironmentVars(options);
|
|
1553
1562
|
const protocolCommands = getPrototype(options);
|
|
1554
1563
|
const bidiPrototype = {};
|
|
1555
|
-
|
|
1556
|
-
|
|
1564
|
+
if (isBidi(options.capabilities)) {
|
|
1565
|
+
const webSocketUrl = options.capabilities?.webSocketUrl;
|
|
1557
1566
|
log5.info(`Register BiDi handler for session with id ${options.sessionId}`);
|
|
1558
1567
|
Object.assign(bidiPrototype, initiateBidi(webSocketUrl, options.strictSSL));
|
|
1559
1568
|
}
|
|
1560
1569
|
const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype, ...bidiPrototype };
|
|
1561
1570
|
const monad = webdriverMonad(options, modifier, prototype);
|
|
1562
1571
|
const client = monad(options.sessionId, commandWrapper);
|
|
1563
|
-
if (
|
|
1572
|
+
if (isBidi(options.capabilities)) {
|
|
1564
1573
|
client._bidiHandler?.socket.on("message", parseBidiMessage.bind(client));
|
|
1565
1574
|
}
|
|
1566
1575
|
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,w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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.5",
|
|
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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "git://github.com/webdriverio/webdriverio.git",
|
|
26
|
+
"url": "git+https://github.com/webdriverio/webdriverio.git",
|
|
27
27
|
"directory": "packages/webdriver"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
@@ -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.
|
|
40
|
-
"@wdio/protocols": "9.0.
|
|
41
|
-
"@wdio/types": "9.0.
|
|
42
|
-
"@wdio/utils": "9.0.
|
|
38
|
+
"@wdio/config": "9.0.5",
|
|
39
|
+
"@wdio/logger": "9.0.4",
|
|
40
|
+
"@wdio/protocols": "9.0.4",
|
|
41
|
+
"@wdio/types": "9.0.4",
|
|
42
|
+
"@wdio/utils": "9.0.5",
|
|
43
43
|
"deepmerge-ts": "^7.0.3",
|
|
44
44
|
"ws": "^8.8.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5ec4340e8caa435212cf4aede2c12dcc662459a4"
|
|
47
47
|
}
|