webdriver 7.20.1 → 7.20.4

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.
@@ -1,6 +1,5 @@
1
1
  import type { Options } from '@wdio/types';
2
2
  export declare const DEFAULTS: Options.Definition<Required<Options.WebDriver>>;
3
- export declare const VALID_CAPS: string[];
4
3
  export declare const REG_EXPS: {
5
4
  commandName: RegExp;
6
5
  execFn: RegExp;
@@ -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,CA0IpE,CAAA;AAED,eAAO,MAAM,UAAU,UAItB,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA"}
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,QAAQ;;;CAGpB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REG_EXPS = exports.VALID_CAPS = exports.DEFAULTS = void 0;
3
+ exports.REG_EXPS = exports.DEFAULTS = void 0;
4
4
  exports.DEFAULTS = {
5
5
  /**
6
6
  * protocol of automation driver
@@ -139,11 +139,6 @@ exports.DEFAULTS = {
139
139
  default: true
140
140
  }
141
141
  };
142
- exports.VALID_CAPS = [
143
- 'browserName', 'browserVersion', 'platformName', 'acceptInsecureCerts',
144
- 'pageLoadStrategy', 'proxy', 'setWindowRect', 'timeouts', 'strictFileInteractability',
145
- 'unhandledPromptBehavior'
146
- ];
147
142
  exports.REG_EXPS = {
148
143
  commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
149
144
  execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
@@ -163,7 +163,7 @@ class WebDriverRequest extends events_1.EventEmitter {
163
163
  if (typeof transformResponse === 'function') {
164
164
  response = transformResponse(response, fullRequestOptions);
165
165
  }
166
- const error = (0, utils_2.getErrorFromResponseBody)(response.body);
166
+ const error = (0, utils_2.getErrorFromResponseBody)(response.body, fullRequestOptions.json);
167
167
  /**
168
168
  * retry connection refused errors
169
169
  */
package/build/utils.d.ts CHANGED
@@ -24,9 +24,9 @@ export declare function getPrototype({ isW3C, isChrome, isFirefox, isMobile, isS
24
24
  * @param {Object} body body object
25
25
  * @return {Object} error
26
26
  */
27
- export declare function getErrorFromResponseBody(body: any): Error;
27
+ export declare function getErrorFromResponseBody(body: any, requestOptions: any): Error;
28
28
  export declare class CustomRequestError extends Error {
29
- constructor(body: WebDriverResponse);
29
+ constructor(body: WebDriverResponse, requestOptions: any);
30
30
  }
31
31
  /**
32
32
  * return all supported flags and return them in a format so we can attach them
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAWvE;;GAEG;AACH,wBAAsB,qBAAqB,CAAE,MAAM,EAAE,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,YAAY,CAAC,mBAAmB,CAAA;CAAE,CAAC,CAmEtJ;AAED;;;;;GAKG;AACH,wBAAgB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AC,YAAY,EAAE,YAAY,CAAC,mBAAmB,CAAA;CAAE,CAAC,CAmEtJ;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,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,sCAyC3H;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;CAyB5D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;EAWlJ;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,QAmBhD;AAED;;;GAGG;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
@@ -10,6 +10,7 @@ const protocols_1 = require("@wdio/protocols");
10
10
  const factory_1 = __importDefault(require("./request/factory"));
11
11
  const command_1 = __importDefault(require("./command"));
12
12
  const utils_1 = require("@wdio/utils");
13
+ const protocols_2 = require("@wdio/protocols");
13
14
  const constants_1 = require("./constants");
14
15
  const log = (0, logger_1.default)('webdriver');
15
16
  const BROWSER_DRIVER_ERRORS = [
@@ -29,7 +30,7 @@ async function startWebDriverSession(params) {
29
30
  if (params.capabilities) {
30
31
  const extensionCaps = Object.keys(params.capabilities).filter((cap) => cap.includes(':'));
31
32
  const invalidWebDriverCaps = Object.keys(params.capabilities)
32
- .filter((cap) => !constants_1.VALID_CAPS.includes(cap) && !cap.includes(':'));
33
+ .filter((cap) => !protocols_2.CAPABILITY_KEYS.includes(cap) && !cap.includes(':'));
33
34
  /**
34
35
  * if there are vendor extensions, e.g. sauce:options or appium:app
35
36
  * used (only WebDriver compatible) and caps that aren't defined
@@ -184,7 +185,7 @@ exports.getPrototype = getPrototype;
184
185
  * @param {Object} body body object
185
186
  * @return {Object} error
186
187
  */
187
- function getErrorFromResponseBody(body) {
188
+ function getErrorFromResponseBody(body, requestOptions) {
188
189
  if (!body) {
189
190
  return new Error('Response has empty body');
190
191
  }
@@ -194,14 +195,22 @@ function getErrorFromResponseBody(body) {
194
195
  if (typeof body !== 'object') {
195
196
  return new Error('Unknown error');
196
197
  }
197
- return new CustomRequestError(body);
198
+ return new CustomRequestError(body, requestOptions);
198
199
  }
199
200
  exports.getErrorFromResponseBody = getErrorFromResponseBody;
200
201
  //Exporting for testability
201
202
  class CustomRequestError extends Error {
202
- constructor(body) {
203
+ constructor(body, requestOptions) {
203
204
  const errorObj = body.value || body;
204
- super(errorObj.message || errorObj.class || 'unknown error');
205
+ let errorMessage = errorObj.message || errorObj.class || 'unknown error';
206
+ /**
207
+ * improve error message for Chrome and Safari on invalid selectors
208
+ */
209
+ if (typeof errorObj.error === 'string' && errorObj.error.includes('invalid selector')) {
210
+ errorMessage = (`The selector "${requestOptions.value}" used with strategy "${requestOptions.using}" is invalid! ` +
211
+ 'For more information on selectors visit the WebdriverIO docs at: https://webdriver.io/docs/selectors');
212
+ }
213
+ super(errorMessage);
205
214
  if (errorObj.error) {
206
215
  this.name = errorObj.error;
207
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webdriver",
3
- "version": "7.20.1",
3
+ "version": "7.20.4",
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",
@@ -25,15 +25,15 @@
25
25
  "@types/lodash.merge": "^4.6.6"
26
26
  },
27
27
  "dependencies": {
28
- "@types/node": "^17.0.4",
29
- "@wdio/config": "7.20.1",
28
+ "@types/node": "^18.0.0",
29
+ "@wdio/config": "7.20.3",
30
30
  "@wdio/logger": "7.19.0",
31
- "@wdio/protocols": "7.20.0",
32
- "@wdio/types": "7.20.0",
33
- "@wdio/utils": "7.20.0",
31
+ "@wdio/protocols": "7.20.4",
32
+ "@wdio/types": "7.20.3",
33
+ "@wdio/utils": "7.20.3",
34
34
  "got": "^11.0.2",
35
35
  "ky": "^0.30.0",
36
36
  "lodash.merge": "^4.6.1"
37
37
  },
38
- "gitHead": "c7d248d891a1da36186034f60970adbc7d254e47"
38
+ "gitHead": "fa39e5fb11b847962450068d40b4c8fe461645b0"
39
39
  }