webdriver 7.16.9 → 7.16.16
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/constants.d.ts +4 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +9 -12
- package/build/index.d.ts.map +1 -1
- package/build/index.js +12 -17
- package/build/request/index.d.ts.map +1 -1
- package/build/request/index.js +2 -1
- package/build/utils.d.ts +12 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +62 -4
- package/package.json +7 -7
package/build/constants.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Options } from '@wdio/types';
|
|
2
2
|
export declare const DEFAULTS: Options.Definition<Required<Options.WebDriver>>;
|
|
3
3
|
export declare const VALID_CAPS: string[];
|
|
4
|
+
export declare const REG_EXPS: {
|
|
5
|
+
commandName: RegExp;
|
|
6
|
+
execFn: RegExp;
|
|
7
|
+
};
|
|
4
8
|
//# 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":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CA0IpE,CAAA;AAED,eAAO,MAAM,UAAU,UAItB,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VALID_CAPS = exports.DEFAULTS = void 0;
|
|
3
|
+
exports.REG_EXPS = exports.VALID_CAPS = exports.DEFAULTS = void 0;
|
|
4
4
|
exports.DEFAULTS = {
|
|
5
5
|
/**
|
|
6
6
|
* protocol of automation driver
|
|
@@ -124,18 +124,11 @@ exports.DEFAULTS = {
|
|
|
124
124
|
},
|
|
125
125
|
/**
|
|
126
126
|
* Appium direct connect options server (https://appiumpro.com/editions/86-connecting-directly-to-appium-hosts-in-distributed-environments)
|
|
127
|
+
* Whether to allow direct connect caps to adjust endpoint details (Appium only)
|
|
127
128
|
*/
|
|
128
|
-
|
|
129
|
-
type: '
|
|
130
|
-
|
|
131
|
-
directConnectHost: {
|
|
132
|
-
type: 'string'
|
|
133
|
-
},
|
|
134
|
-
directConnectPort: {
|
|
135
|
-
type: 'number'
|
|
136
|
-
},
|
|
137
|
-
directConnectPath: {
|
|
138
|
-
type: 'string'
|
|
129
|
+
enableDirectConnect: {
|
|
130
|
+
type: 'boolean',
|
|
131
|
+
default: true
|
|
139
132
|
},
|
|
140
133
|
/**
|
|
141
134
|
* Whether it requires SSL certificates to be valid in HTTP/s requests
|
|
@@ -151,3 +144,7 @@ exports.VALID_CAPS = [
|
|
|
151
144
|
'pageLoadStrategy', 'proxy', 'setWindowRect', 'timeouts', 'strictFileInteractability',
|
|
152
145
|
'unhandledPromptBehavior'
|
|
153
146
|
];
|
|
147
|
+
exports.REG_EXPS = {
|
|
148
|
+
commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
|
|
149
|
+
execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
|
|
150
|
+
};
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,E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 +38,6 @@ class WebDriver {
|
|
|
38
38
|
process.env.WDIO_LOG_PATH = path_1.default.join(params.outputDir, 'wdio.log');
|
|
39
39
|
}
|
|
40
40
|
log.info('Initiate new session using the WebDriver protocol');
|
|
41
|
-
/**
|
|
42
|
-
* if the server responded with direct connect information, update the
|
|
43
|
-
* params to speak directly to the appium host instead of a load
|
|
44
|
-
* balancer (see https://github.com/appium/python-client#direct-connect-urls
|
|
45
|
-
* for example). But only do this if the user has enabled this
|
|
46
|
-
* behavior in the first place.
|
|
47
|
-
*/
|
|
48
|
-
const { directConnectProtocol, directConnectHost, directConnectPort, directConnectPath } = params;
|
|
49
|
-
if (directConnectProtocol && directConnectHost && directConnectPort && (directConnectPath || directConnectPath === '')) {
|
|
50
|
-
log.info('Found direct connect information in new session response. ' +
|
|
51
|
-
`Will connect to server at ${directConnectProtocol}://${directConnectHost}:${directConnectPort}/${directConnectPath}`);
|
|
52
|
-
params.protocol = directConnectProtocol;
|
|
53
|
-
params.hostname = directConnectHost;
|
|
54
|
-
params.port = directConnectPort;
|
|
55
|
-
params.path = directConnectPath;
|
|
56
|
-
}
|
|
57
41
|
const requestedCapabilities = { ...params.capabilities };
|
|
58
42
|
const { sessionId, capabilities } = await (0, utils_2.startWebDriverSession)(params);
|
|
59
43
|
const environment = (0, utils_1.sessionEnvironmentDetector)({ capabilities, requestedCapabilities });
|
|
@@ -61,7 +45,18 @@ class WebDriver {
|
|
|
61
45
|
const protocolCommands = (0, utils_2.getPrototype)(environment);
|
|
62
46
|
const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype };
|
|
63
47
|
const monad = (0, utils_1.webdriverMonad)({ ...params, requestedCapabilities }, modifier, prototype);
|
|
64
|
-
|
|
48
|
+
const client = monad(sessionId, customCommandWrapper);
|
|
49
|
+
/**
|
|
50
|
+
* if the server responded with direct connect information, update the
|
|
51
|
+
* client options to speak directly to the appium host instead of a load
|
|
52
|
+
* balancer (see https://github.com/appium/python-client#direct-connect-urls
|
|
53
|
+
* for example). But only do this if the user has enabled this
|
|
54
|
+
* behavior in the first place.
|
|
55
|
+
*/
|
|
56
|
+
if (params.enableDirectConnect) {
|
|
57
|
+
(0, utils_2.setupDirectConnect)(client);
|
|
58
|
+
}
|
|
59
|
+
return client;
|
|
65
60
|
}
|
|
66
61
|
/**
|
|
67
62
|
* allows user to attach to existing sessions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAK9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAM1C,aAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AAC5B,aAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAClD,aAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACpD,aAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAE7D,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;AAWD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ,YAAY;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM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AA;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;AAWD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ,YAAY;IAC/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;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,cAAc,EAAE,iBAAiB,CAKhC;gBAEY,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;IAU5G,WAAW,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM;IAYxD,SAAS,CAAC,cAAc,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe,GAAG,iBAAiB;cAiErG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAIhF,QAAQ;CA8GzB"}
|
package/build/request/index.js
CHANGED
|
@@ -144,7 +144,8 @@ class WebDriverRequest extends events_1.EventEmitter {
|
|
|
144
144
|
* handle timeouts
|
|
145
145
|
*/
|
|
146
146
|
if (response.code === 'ETIMEDOUT') {
|
|
147
|
-
|
|
147
|
+
const error = (0, utils_2.getTimeoutError)(response, fullRequestOptions);
|
|
148
|
+
return retry(error, 'Request timed out! Consider increasing the "connectionRetryTimeout" option.');
|
|
148
149
|
}
|
|
149
150
|
/**
|
|
150
151
|
* throw if request error is unknown
|
package/build/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Options, Capabilities } from '@wdio/types';
|
|
2
2
|
import { WebDriverResponse } from './request';
|
|
3
|
-
import type { JSONWPCommandError, SessionFlags } from './types';
|
|
3
|
+
import type { Client, JSONWPCommandError, SessionFlags } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* start browser session with WebDriver protocol
|
|
6
6
|
*/
|
|
@@ -60,9 +60,20 @@ export declare function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid,
|
|
|
60
60
|
value: boolean | undefined;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Decorate the client's options object with host updates based on the presence of
|
|
65
|
+
* directConnect capabilities in the new session response. Note that this
|
|
66
|
+
* mutates the object.
|
|
67
|
+
* @param {Client} params post-new-session client
|
|
68
|
+
*/
|
|
69
|
+
export declare function setupDirectConnect(client: Client): void;
|
|
63
70
|
/**
|
|
64
71
|
* get human readable message from response error
|
|
65
72
|
* @param {Error} err response error
|
|
66
73
|
*/
|
|
67
74
|
export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string;
|
|
75
|
+
/**
|
|
76
|
+
* return timeout error with information about the executing command on which the test hangs
|
|
77
|
+
*/
|
|
78
|
+
export declare const getTimeoutError: (error: Error, requestOptions: Options.RequestLibOptions) => Error;
|
|
68
79
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,YAAY,EA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G;AACH,eAAO,MAAM,eAAe,QAAS,kBAAkB,WAAU,QAAQ,iBAAiB,CAAC,WAmD1F,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,UAAW,KAAK,kBAAkB,QAAQ,iBAAiB,KAAG,KASzF,CAAA"}
|
package/build/utils.js
CHANGED
|
@@ -3,12 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSessionError = exports.getEnvironmentVars = exports.CustomRequestError = exports.getErrorFromResponseBody = exports.getPrototype = exports.isSuccessfulResponse = exports.startWebDriverSession = void 0;
|
|
6
|
+
exports.getTimeoutError = exports.getSessionError = exports.setupDirectConnect = exports.getEnvironmentVars = exports.CustomRequestError = exports.getErrorFromResponseBody = exports.getPrototype = exports.isSuccessfulResponse = exports.startWebDriverSession = void 0;
|
|
7
7
|
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
8
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
9
9
|
const protocols_1 = require("@wdio/protocols");
|
|
10
10
|
const factory_1 = __importDefault(require("./request/factory"));
|
|
11
11
|
const command_1 = __importDefault(require("./command"));
|
|
12
|
+
const utils_1 = require("@wdio/utils");
|
|
12
13
|
const constants_1 = require("./constants");
|
|
13
14
|
const log = (0, logger_1.default)('webdriver');
|
|
14
15
|
const BROWSER_DRIVER_ERRORS = [
|
|
@@ -210,9 +211,7 @@ class CustomRequestError extends Error {
|
|
|
210
211
|
else {
|
|
211
212
|
this.name = errorObj.name || 'WebDriver Error';
|
|
212
213
|
}
|
|
213
|
-
|
|
214
|
-
this.stack = errorObj.stacktrace;
|
|
215
|
-
}
|
|
214
|
+
Error.captureStackTrace(this, CustomRequestError);
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
217
|
exports.CustomRequestError = CustomRequestError;
|
|
@@ -235,6 +234,33 @@ function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isChrome, isFir
|
|
|
235
234
|
};
|
|
236
235
|
}
|
|
237
236
|
exports.getEnvironmentVars = getEnvironmentVars;
|
|
237
|
+
/**
|
|
238
|
+
* Decorate the client's options object with host updates based on the presence of
|
|
239
|
+
* directConnect capabilities in the new session response. Note that this
|
|
240
|
+
* mutates the object.
|
|
241
|
+
* @param {Client} params post-new-session client
|
|
242
|
+
*/
|
|
243
|
+
function setupDirectConnect(client) {
|
|
244
|
+
const capabilities = client.capabilities;
|
|
245
|
+
const directConnectProtocol = capabilities.directConnectProtocol || capabilities['appium:directConnectProtocol'];
|
|
246
|
+
const directConnectHost = capabilities.directConnectHost || capabilities['appium:directConnectHost'];
|
|
247
|
+
let directConnectPath = capabilities.directConnectPath;
|
|
248
|
+
if (!(directConnectPath || directConnectPath === '')) {
|
|
249
|
+
directConnectPath = capabilities['appium:directConnectPath'];
|
|
250
|
+
}
|
|
251
|
+
const directConnectPort = capabilities.directConnectPort || capabilities['appium:directConnectPort'];
|
|
252
|
+
if (directConnectProtocol && directConnectHost && directConnectPort &&
|
|
253
|
+
(directConnectPath || directConnectPath === '')) {
|
|
254
|
+
log.info('Found direct connect information in new session response. ' +
|
|
255
|
+
`Will connect to server at ${directConnectProtocol}://` +
|
|
256
|
+
`${directConnectHost}:${directConnectPort}${directConnectPath}`);
|
|
257
|
+
client.options.protocol = directConnectProtocol;
|
|
258
|
+
client.options.hostname = directConnectHost;
|
|
259
|
+
client.options.port = directConnectPort;
|
|
260
|
+
client.options.path = directConnectPath;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.setupDirectConnect = setupDirectConnect;
|
|
238
264
|
/**
|
|
239
265
|
* get human readable message from response error
|
|
240
266
|
* @param {Error} err response error
|
|
@@ -283,3 +309,35 @@ const getSessionError = (err, params = {}) => {
|
|
|
283
309
|
return err.message;
|
|
284
310
|
};
|
|
285
311
|
exports.getSessionError = getSessionError;
|
|
312
|
+
/**
|
|
313
|
+
* return timeout error with information about the executing command on which the test hangs
|
|
314
|
+
*/
|
|
315
|
+
const getTimeoutError = (error, requestOptions) => {
|
|
316
|
+
const cmdName = getExecCmdName(requestOptions);
|
|
317
|
+
const cmdArgs = getExecCmdArgs(requestOptions);
|
|
318
|
+
const cmdInfoMsg = `when running "${cmdName}" with method "${requestOptions.method}"`;
|
|
319
|
+
const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : '';
|
|
320
|
+
const timeoutErr = new Error(`${error.message} ${cmdInfoMsg}${cmdArgsMsg}`);
|
|
321
|
+
return Object.assign(timeoutErr, error);
|
|
322
|
+
};
|
|
323
|
+
exports.getTimeoutError = getTimeoutError;
|
|
324
|
+
function getExecCmdName(requestOptions) {
|
|
325
|
+
const { href } = requestOptions.url;
|
|
326
|
+
const res = href.match(constants_1.REG_EXPS.commandName) || [];
|
|
327
|
+
return res[1] || href;
|
|
328
|
+
}
|
|
329
|
+
function getExecCmdArgs(requestOptions) {
|
|
330
|
+
const { json: cmdJson } = requestOptions;
|
|
331
|
+
if (typeof cmdJson !== 'object') {
|
|
332
|
+
return '';
|
|
333
|
+
}
|
|
334
|
+
const transformedRes = (0, utils_1.transformCommandLogResult)(cmdJson);
|
|
335
|
+
if (typeof transformedRes === 'string') {
|
|
336
|
+
return transformedRes;
|
|
337
|
+
}
|
|
338
|
+
if (typeof cmdJson.script === 'string') {
|
|
339
|
+
const scriptRes = cmdJson.script.match(constants_1.REG_EXPS.execFn) || [];
|
|
340
|
+
return `"${scriptRes[1] || cmdJson.script}"`;
|
|
341
|
+
}
|
|
342
|
+
return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : '';
|
|
343
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriver",
|
|
3
|
-
"version": "7.16.
|
|
3
|
+
"version": "7.16.16",
|
|
4
4
|
"description": "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
5
5
|
"author": "Christian Bromann <christian@saucelabs.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@types/lodash.merge": "^4.6.6"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@types/node": "^
|
|
29
|
-
"@wdio/config": "7.16.
|
|
28
|
+
"@types/node": "^17.0.4",
|
|
29
|
+
"@wdio/config": "7.16.16",
|
|
30
30
|
"@wdio/logger": "7.16.0",
|
|
31
31
|
"@wdio/protocols": "7.16.7",
|
|
32
|
-
"@wdio/types": "7.16.
|
|
33
|
-
"@wdio/utils": "7.16.
|
|
32
|
+
"@wdio/types": "7.16.14",
|
|
33
|
+
"@wdio/utils": "7.16.14",
|
|
34
34
|
"got": "^11.0.2",
|
|
35
|
-
"ky": "^0.
|
|
35
|
+
"ky": "^0.29.0",
|
|
36
36
|
"lodash.merge": "^4.6.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "10597a2afe43b2f64ed9bf0ddae3f3f77d280047"
|
|
39
39
|
}
|