webdriver 9.1.1 → 9.1.2

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,5 +1,5 @@
1
1
  import { type CommandEndpoint } from '@wdio/protocols';
2
- import type { WebDriverResponse } from './request/index.js';
2
+ import type { WebDriverResponse } from './request/types.js';
3
3
  import type { BaseClient, BidiResponses } from './types.js';
4
4
  export default function (method: string, endpointUri: string, commandInfo: CommandEndpoint, doubleEncodeVariables?: boolean): (this: BaseClient, ...args: any[]) => Promise<WebDriverResponse | BidiResponses | void>;
5
5
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,eAAe,EACvB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAA;AAKzE,MAAM,CAAC,OAAO,WACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,EAC5B,qBAAqB,UAAQ,UAIgB,UAAU,WAAW,GAAG,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CA0J9H"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAG7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAA;AAKzE,MAAM,CAAC,OAAO,WACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,EAC5B,qBAAqB,UAAQ,UAIgB,UAAU,WAAW,GAAG,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CA0J9H"}
@@ -1,10 +1,6 @@
1
1
  import type { Options } from '@wdio/types';
2
2
  import type { RemoteConfig } from './types.js';
3
3
  export declare const DEFAULTS: Options.Definition<Required<RemoteConfig>>;
4
- export declare const REG_EXPS: {
5
- commandName: RegExp;
6
- execFn: RegExp;
7
- };
8
4
  export declare const ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
9
5
  export declare const SHADOW_ELEMENT_KEY = "shadow-6066-11e4-a52e-4f735466cecf";
10
6
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CA2I/D,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA;AAED,eAAO,MAAM,WAAW,wCAAwC,CAAA;AAChE,eAAO,MAAM,kBAAkB,uCAAuC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CA2I/D,CAAA;AAED,eAAO,MAAM,WAAW,wCAAwC,CAAA;AAChE,eAAO,MAAM,kBAAkB,uCAAuC,CAAA"}
package/build/index.cjs CHANGED
@@ -30,6 +30,82 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
+ // src/request/constants.ts
34
+ var REG_EXPS;
35
+ var init_constants = __esm({
36
+ "src/request/constants.ts"() {
37
+ "use strict";
38
+ REG_EXPS = {
39
+ commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
40
+ execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
41
+ };
42
+ }
43
+ });
44
+
45
+ // src/request/error.ts
46
+ var import_utils, WebDriverError, WebDriverRequestError;
47
+ var init_error = __esm({
48
+ "src/request/error.ts"() {
49
+ "use strict";
50
+ import_utils = require("@wdio/utils");
51
+ init_constants();
52
+ WebDriverError = class extends Error {
53
+ /**
54
+ * return timeout error with information about the executing command on which the test hangs
55
+ */
56
+ computeErrorMessage() {
57
+ const cmdName = this.#getExecCmdName();
58
+ const cmdArgs = this.#getExecCmdArgs(this.opts);
59
+ const cmdInfoMsg = `when running "${cmdName}" with method "${this.opts.method}"`;
60
+ const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : "";
61
+ return `WebDriverError: ${this.message} ${cmdInfoMsg}${cmdArgsMsg}`;
62
+ }
63
+ #getExecCmdName() {
64
+ const { href } = this.url;
65
+ const res = href.match(REG_EXPS.commandName) || [];
66
+ return res[1] || href;
67
+ }
68
+ #getExecCmdArgs(requestOptions) {
69
+ const { body: cmdJson } = requestOptions;
70
+ if (typeof cmdJson !== "object") {
71
+ return "";
72
+ }
73
+ const transformedRes = (0, import_utils.transformCommandLogResult)(cmdJson);
74
+ if (typeof transformedRes === "string") {
75
+ return transformedRes;
76
+ }
77
+ if (typeof cmdJson.script === "string") {
78
+ const scriptRes = cmdJson.script.match(REG_EXPS.execFn) || [];
79
+ return `"${scriptRes[1] || cmdJson.script}"`;
80
+ }
81
+ return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : "";
82
+ }
83
+ };
84
+ WebDriverRequestError = class extends WebDriverError {
85
+ url;
86
+ opts;
87
+ statusCode;
88
+ body;
89
+ code;
90
+ constructor(err, url, opts) {
91
+ let message = err.message;
92
+ if (err.message === "fetch failed") {
93
+ message = `Failed to fetch [${opts.method}] ${url.href}: please make sure you have a WebDriver compatible server running on ${url.origin}`;
94
+ }
95
+ super(message);
96
+ this.url = url;
97
+ this.opts = opts;
98
+ const errorCode = typeof err.cause === "object" && err.cause && "code" in err.cause && typeof err.cause.code === "string" ? err.cause.code : "code" in err && typeof err.code === "string" ? err.code : void 0;
99
+ if (errorCode) {
100
+ this.code = errorCode;
101
+ this.message = errorCode === "UND_ERR_CONNECT_TIMEOUT" ? 'Request timed out! Consider increasing the "connectionRetryTimeout" option.' : "Request failed with error code " + errorCode;
102
+ }
103
+ this.message = this.computeErrorMessage();
104
+ }
105
+ };
106
+ }
107
+ });
108
+
33
109
  // src/request/request.ts
34
110
  var import_node_perf_hooks, import_node_dns, import_index, FetchRequest;
35
111
  var init_request = __esm({
@@ -38,6 +114,7 @@ var init_request = __esm({
38
114
  import_node_perf_hooks = require("node:perf_hooks");
39
115
  import_node_dns = __toESM(require("node:dns"), 1);
40
116
  import_index = __toESM(require("./index.js"), 1);
117
+ init_error();
41
118
  if ("process" in globalThis && globalThis.process.versions?.node) {
42
119
  import_node_dns.default.setDefaultResultOrder("ipv4first");
43
120
  }
@@ -60,9 +137,13 @@ var init_request = __esm({
60
137
  };
61
138
  } catch (err) {
62
139
  if (!(err instanceof Error)) {
63
- throw new import_index.RequestLibError(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`);
140
+ throw new WebDriverRequestError(
141
+ new Error(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`),
142
+ url,
143
+ opts
144
+ );
64
145
  }
65
- throw err;
146
+ throw new WebDriverRequestError(err, url, opts);
66
147
  }
67
148
  }
68
149
  _libPerformanceNow() {
@@ -122,11 +203,11 @@ Usage: ${commandUsage}` + parameterDescription + moreInfo
122
203
  }
123
204
  const i = parseInt(it, 10);
124
205
  const commandParam = commandParams[i];
125
- if (!(0, import_utils.isValidParameter)(arg, commandParam.type)) {
206
+ if (!(0, import_utils2.isValidParameter)(arg, commandParam.type)) {
126
207
  if (typeof arg === "undefined" && !commandParam.required) {
127
208
  continue;
128
209
  }
129
- const actual = commandParam.type.endsWith("[]") ? `(${(Array.isArray(arg) ? arg : [arg]).map((a) => (0, import_utils.getArgumentType)(a))})[]` : (0, import_utils.getArgumentType)(arg);
210
+ const actual = commandParam.type.endsWith("[]") ? `(${(Array.isArray(arg) ? arg : [arg]).map((a) => (0, import_utils2.getArgumentType)(a))})[]` : (0, import_utils2.getArgumentType)(arg);
130
211
  throw new Error(
131
212
  `Malformed type for "${commandParam.name}" parameter of command ${command2}
132
213
  Expected: ${commandParam.type}
@@ -143,7 +224,7 @@ Actual: ${actual}` + moreInfo
143
224
  const request = new FetchRequest(method, endpoint, body, isHubCommand);
144
225
  request.on("performance", (...args2) => this.emit("request.performance", ...args2));
145
226
  this.emit("command", { command: command2, method, endpoint, body });
146
- log.info("COMMAND", (0, import_utils.commandCallStructure)(command2, args));
227
+ log.info("COMMAND", (0, import_utils2.commandCallStructure)(command2, args));
147
228
  return request.makeRequest(this.options, this.sessionId).then((result) => {
148
229
  if (typeof result.value !== "undefined") {
149
230
  let resultLog = result.value;
@@ -179,12 +260,12 @@ Actual: ${actual}` + moreInfo
179
260
  });
180
261
  };
181
262
  }
182
- var import_logger, import_utils, import_protocols, log, BIDI_COMMANDS;
263
+ var import_logger, import_utils2, import_protocols, log, BIDI_COMMANDS;
183
264
  var init_command = __esm({
184
265
  "src/command.ts"() {
185
266
  "use strict";
186
267
  import_logger = __toESM(require("@wdio/logger"), 1);
187
- import_utils = require("@wdio/utils");
268
+ import_utils2 = require("@wdio/utils");
188
269
  import_protocols = require("@wdio/protocols");
189
270
  init_request();
190
271
  log = (0, import_logger.default)("webdriver");
package/build/index.js CHANGED
@@ -6,9 +6,7 @@ import { validateConfig } from "@wdio/config";
6
6
  // src/command.ts
7
7
  import logger4 from "@wdio/logger";
8
8
  import { commandCallStructure, isValidParameter, getArgumentType } from "@wdio/utils";
9
- import {
10
- WebDriverBidiProtocol as WebDriverBidiProtocol2
11
- } from "@wdio/protocols";
9
+ import { WebDriverBidiProtocol as WebDriverBidiProtocol2 } from "@wdio/protocols";
12
10
 
13
11
  // src/request/request.ts
14
12
  import { performance } from "node:perf_hooks";
@@ -22,6 +20,9 @@ import { URL } from "node:url";
22
20
  import logger3 from "@wdio/logger";
23
21
  import { transformCommandLogResult as transformCommandLogResult2 } from "@wdio/utils";
24
22
 
23
+ // src/request/error.ts
24
+ import { transformCommandLogResult } from "@wdio/utils";
25
+
25
26
  // src/request/constants.ts
26
27
  var RETRYABLE_STATUS_CODES = [408, 413, 429, 500, 502, 503, 504];
27
28
  var RETRYABLE_ERROR_CODES = [
@@ -32,8 +33,94 @@ var RETRYABLE_ERROR_CODES = [
32
33
  "EPIPE",
33
34
  "ENOTFOUND",
34
35
  "ENETUNREACH",
35
- "EAI_AGAIN"
36
+ "EAI_AGAIN",
37
+ // additional error codes we like to retry
38
+ "UND_ERR_CONNECT_TIMEOUT"
36
39
  ];
40
+ var REG_EXPS = {
41
+ commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
42
+ execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
43
+ };
44
+
45
+ // src/request/error.ts
46
+ var WebDriverError = class extends Error {
47
+ /**
48
+ * return timeout error with information about the executing command on which the test hangs
49
+ */
50
+ computeErrorMessage() {
51
+ const cmdName = this.#getExecCmdName();
52
+ const cmdArgs = this.#getExecCmdArgs(this.opts);
53
+ const cmdInfoMsg = `when running "${cmdName}" with method "${this.opts.method}"`;
54
+ const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : "";
55
+ return `WebDriverError: ${this.message} ${cmdInfoMsg}${cmdArgsMsg}`;
56
+ }
57
+ #getExecCmdName() {
58
+ const { href } = this.url;
59
+ const res = href.match(REG_EXPS.commandName) || [];
60
+ return res[1] || href;
61
+ }
62
+ #getExecCmdArgs(requestOptions) {
63
+ const { body: cmdJson } = requestOptions;
64
+ if (typeof cmdJson !== "object") {
65
+ return "";
66
+ }
67
+ const transformedRes = transformCommandLogResult(cmdJson);
68
+ if (typeof transformedRes === "string") {
69
+ return transformedRes;
70
+ }
71
+ if (typeof cmdJson.script === "string") {
72
+ const scriptRes = cmdJson.script.match(REG_EXPS.execFn) || [];
73
+ return `"${scriptRes[1] || cmdJson.script}"`;
74
+ }
75
+ return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : "";
76
+ }
77
+ };
78
+ var WebDriverRequestError = class extends WebDriverError {
79
+ url;
80
+ opts;
81
+ statusCode;
82
+ body;
83
+ code;
84
+ constructor(err, url, opts) {
85
+ let message = err.message;
86
+ if (err.message === "fetch failed") {
87
+ message = `Failed to fetch [${opts.method}] ${url.href}: please make sure you have a WebDriver compatible server running on ${url.origin}`;
88
+ }
89
+ super(message);
90
+ this.url = url;
91
+ this.opts = opts;
92
+ const errorCode = typeof err.cause === "object" && err.cause && "code" in err.cause && typeof err.cause.code === "string" ? err.cause.code : "code" in err && typeof err.code === "string" ? err.code : void 0;
93
+ if (errorCode) {
94
+ this.code = errorCode;
95
+ this.message = errorCode === "UND_ERR_CONNECT_TIMEOUT" ? 'Request timed out! Consider increasing the "connectionRetryTimeout" option.' : "Request failed with error code " + errorCode;
96
+ }
97
+ this.message = this.computeErrorMessage();
98
+ }
99
+ };
100
+ var WebDriverResponseError = class _WebDriverResponseError extends WebDriverError {
101
+ url;
102
+ opts;
103
+ constructor(response, url, opts) {
104
+ const errorObj = !response.body ? new Error("Response has empty body") : typeof response.body === "string" && response.body.length ? new Error(response.body) : typeof response.body !== "object" ? new Error("Unknown error") : response.body.value || response.body;
105
+ let errorMessage = errorObj.message || errorObj.error || errorObj.class || "unknown error";
106
+ if (typeof errorMessage === "string" && errorMessage.includes("invalid locator")) {
107
+ const requestOptions = opts.body;
108
+ errorMessage = `The selector "${requestOptions.value}" used with strategy "${requestOptions.using}" is invalid!`;
109
+ }
110
+ super(errorMessage);
111
+ if (errorObj.error) {
112
+ this.name = errorObj.error;
113
+ } else if (errorMessage && errorMessage.includes("stale element reference")) {
114
+ this.name = "stale element reference";
115
+ } else {
116
+ this.name = errorObj.name || "WebDriver Error";
117
+ }
118
+ Error.captureStackTrace(this, _WebDriverResponseError);
119
+ this.url = url;
120
+ this.opts = opts;
121
+ this.message = this.computeErrorMessage();
122
+ }
123
+ };
37
124
 
38
125
  // src/utils.ts
39
126
  import { deepmergeCustom } from "deepmerge-ts";
@@ -48,7 +135,6 @@ import {
48
135
  GeckoProtocol,
49
136
  WebDriverBidiProtocol
50
137
  } from "@wdio/protocols";
51
- import { transformCommandLogResult } from "@wdio/utils";
52
138
  import { CAPABILITY_KEYS } from "@wdio/protocols";
53
139
 
54
140
  // src/bidi/core.ts
@@ -726,154 +812,6 @@ var BidiHandler = class extends BidiCore {
726
812
  }
727
813
  };
728
814
 
729
- // src/constants.ts
730
- import os from "node:os";
731
- var DEFAULTS = {
732
- /**
733
- * protocol of automation driver
734
- */
735
- protocol: {
736
- type: "string",
737
- default: "http",
738
- match: /(http|https)/
739
- },
740
- /**
741
- * hostname of automation driver
742
- */
743
- hostname: {
744
- type: "string",
745
- default: "localhost"
746
- },
747
- /**
748
- * port of automation driver
749
- */
750
- port: {
751
- type: "number"
752
- },
753
- /**
754
- * path to WebDriver endpoints
755
- */
756
- path: {
757
- type: "string",
758
- validate: (path2) => {
759
- if (!path2.startsWith("/")) {
760
- throw new TypeError('The option "path" needs to start with a "/"');
761
- }
762
- return true;
763
- },
764
- default: "/"
765
- },
766
- /**
767
- * A key-value store of query parameters to be added to every selenium request
768
- */
769
- queryParams: {
770
- type: "object"
771
- },
772
- /**
773
- * cloud user if applicable
774
- */
775
- user: {
776
- type: "string"
777
- },
778
- /**
779
- * access key to user
780
- */
781
- key: {
782
- type: "string"
783
- },
784
- /**
785
- * capability of WebDriver session
786
- */
787
- capabilities: {
788
- type: "object",
789
- required: true
790
- },
791
- /**
792
- * Level of logging verbosity
793
- */
794
- logLevel: {
795
- type: "string",
796
- default: "info",
797
- match: /(trace|debug|info|warn|error|silent)/
798
- },
799
- /**
800
- * directory for log files
801
- */
802
- outputDir: {
803
- type: "string"
804
- },
805
- /**
806
- * Timeout for any WebDriver request to a driver or grid
807
- */
808
- connectionRetryTimeout: {
809
- type: "number",
810
- default: 12e4
811
- },
812
- /**
813
- * Count of request retries to the Selenium server
814
- */
815
- connectionRetryCount: {
816
- type: "number",
817
- default: 3
818
- },
819
- /**
820
- * Override default agent
821
- */
822
- logLevels: {
823
- type: "object"
824
- },
825
- /**
826
- * Pass custom headers
827
- */
828
- headers: {
829
- type: "object"
830
- },
831
- /**
832
- * Function transforming the request options before the request is made
833
- */
834
- transformRequest: {
835
- type: "function",
836
- default: (requestOptions) => requestOptions
837
- },
838
- /**
839
- * Function transforming the response object after it is received
840
- */
841
- transformResponse: {
842
- type: "function",
843
- default: (response) => response
844
- },
845
- /**
846
- * Appium direct connect options server (https://appiumpro.com/editions/86-connecting-directly-to-appium-hosts-in-distributed-environments)
847
- * Whether to allow direct connect caps to adjust endpoint details (Appium only)
848
- */
849
- enableDirectConnect: {
850
- type: "boolean",
851
- default: true
852
- },
853
- /**
854
- * Whether it requires SSL certificates to be valid in HTTP/s requests
855
- * for an environment which cannot get process environment well.
856
- */
857
- strictSSL: {
858
- type: "boolean",
859
- default: true
860
- },
861
- /**
862
- * The path to the root of the cache directory. This directory is used to store all drivers that are downloaded
863
- * when attempting to start a session.
864
- */
865
- cacheDir: {
866
- type: "string",
867
- default: process.env.WEBDRIVER_CACHE_DIR || os.tmpdir()
868
- }
869
- };
870
- var REG_EXPS = {
871
- commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
872
- execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
873
- };
874
- var ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
875
- var SHADOW_ELEMENT_KEY = "shadow-6066-11e4-a52e-4f735466cecf";
876
-
877
815
  // src/utils.ts
878
816
  var log2 = logger2("webdriver");
879
817
  var deepmerge = deepmergeCustom({ mergeArrays: false });
@@ -1005,36 +943,6 @@ function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSelen
1005
943
  }
1006
944
  return prototype;
1007
945
  }
1008
- function getErrorFromResponseBody(body, requestOptions) {
1009
- if (!body) {
1010
- return new Error("Response has empty body");
1011
- }
1012
- if (typeof body === "string" && body.length) {
1013
- return new Error(body);
1014
- }
1015
- if (typeof body !== "object") {
1016
- return new Error("Unknown error");
1017
- }
1018
- return new CustomRequestError(body, requestOptions);
1019
- }
1020
- var CustomRequestError = class _CustomRequestError extends Error {
1021
- constructor(body, requestOptions) {
1022
- const errorObj = body.value || body;
1023
- let errorMessage = errorObj.message || errorObj.error || errorObj.class || "unknown error";
1024
- if (typeof errorMessage === "string" && errorMessage.includes("invalid locator")) {
1025
- errorMessage = `The selector "${requestOptions.value}" used with strategy "${requestOptions.using}" is invalid!`;
1026
- }
1027
- super(errorMessage);
1028
- if (errorObj.error) {
1029
- this.name = errorObj.error;
1030
- } else if (errorMessage && errorMessage.includes("stale element reference")) {
1031
- this.name = "stale element reference";
1032
- } else {
1033
- this.name = errorObj.name || "WebDriver Error";
1034
- }
1035
- Error.captureStackTrace(this, _CustomRequestError);
1036
- }
1037
- };
1038
946
  function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isFirefox, isSauce, isSeleniumStandalone, isBidi: isBidi2, isChromium }) {
1039
947
  return {
1040
948
  isW3C: { value: isW3C },
@@ -1094,34 +1002,6 @@ It seems like the service failed to start or is rejecting any connections.`;
1094
1002
  }
1095
1003
  return err.message;
1096
1004
  };
1097
- function getRequestError(error, requestOptions, url) {
1098
- const cmdName = getExecCmdName(url);
1099
- const cmdArgs = getExecCmdArgs(requestOptions);
1100
- const cmdInfoMsg = `when running "${cmdName}" with method "${requestOptions.method}"`;
1101
- const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : "";
1102
- const timeoutErr = new Error(`${error.message} ${cmdInfoMsg}${cmdArgsMsg}`);
1103
- return Object.assign(timeoutErr, error);
1104
- }
1105
- function getExecCmdName(url) {
1106
- const { href } = url;
1107
- const res = href.match(REG_EXPS.commandName) || [];
1108
- return res[1] || href;
1109
- }
1110
- function getExecCmdArgs(requestOptions) {
1111
- const { body: cmdJson } = requestOptions;
1112
- if (typeof cmdJson !== "object") {
1113
- return "";
1114
- }
1115
- const transformedRes = transformCommandLogResult(cmdJson);
1116
- if (typeof transformedRes === "string") {
1117
- return transformedRes;
1118
- }
1119
- if (typeof cmdJson.script === "string") {
1120
- const scriptRes = cmdJson.script.match(REG_EXPS.execFn) || [];
1121
- return `"${scriptRes[1] || cmdJson.script}"`;
1122
- }
1123
- return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : "";
1124
- }
1125
1005
  function initiateBidi(socketUrl, strictSSL = true) {
1126
1006
  socketUrl = socketUrl.replace("localhost", "127.0.0.1");
1127
1007
  const bidiReqOpts = strictSSL ? {} : { rejectUnauthorized: false };
@@ -1149,10 +1029,154 @@ function parseBidiMessage(data) {
1149
1029
  }
1150
1030
  }
1151
1031
 
1032
+ // src/constants.ts
1033
+ import os from "node:os";
1034
+ var DEFAULTS = {
1035
+ /**
1036
+ * protocol of automation driver
1037
+ */
1038
+ protocol: {
1039
+ type: "string",
1040
+ default: "http",
1041
+ match: /(http|https)/
1042
+ },
1043
+ /**
1044
+ * hostname of automation driver
1045
+ */
1046
+ hostname: {
1047
+ type: "string",
1048
+ default: "localhost"
1049
+ },
1050
+ /**
1051
+ * port of automation driver
1052
+ */
1053
+ port: {
1054
+ type: "number"
1055
+ },
1056
+ /**
1057
+ * path to WebDriver endpoints
1058
+ */
1059
+ path: {
1060
+ type: "string",
1061
+ validate: (path2) => {
1062
+ if (!path2.startsWith("/")) {
1063
+ throw new TypeError('The option "path" needs to start with a "/"');
1064
+ }
1065
+ return true;
1066
+ },
1067
+ default: "/"
1068
+ },
1069
+ /**
1070
+ * A key-value store of query parameters to be added to every selenium request
1071
+ */
1072
+ queryParams: {
1073
+ type: "object"
1074
+ },
1075
+ /**
1076
+ * cloud user if applicable
1077
+ */
1078
+ user: {
1079
+ type: "string"
1080
+ },
1081
+ /**
1082
+ * access key to user
1083
+ */
1084
+ key: {
1085
+ type: "string"
1086
+ },
1087
+ /**
1088
+ * capability of WebDriver session
1089
+ */
1090
+ capabilities: {
1091
+ type: "object",
1092
+ required: true
1093
+ },
1094
+ /**
1095
+ * Level of logging verbosity
1096
+ */
1097
+ logLevel: {
1098
+ type: "string",
1099
+ default: "info",
1100
+ match: /(trace|debug|info|warn|error|silent)/
1101
+ },
1102
+ /**
1103
+ * directory for log files
1104
+ */
1105
+ outputDir: {
1106
+ type: "string"
1107
+ },
1108
+ /**
1109
+ * Timeout for any WebDriver request to a driver or grid
1110
+ */
1111
+ connectionRetryTimeout: {
1112
+ type: "number",
1113
+ default: 12e4
1114
+ },
1115
+ /**
1116
+ * Count of request retries to the Selenium server
1117
+ */
1118
+ connectionRetryCount: {
1119
+ type: "number",
1120
+ default: 3
1121
+ },
1122
+ /**
1123
+ * Override default agent
1124
+ */
1125
+ logLevels: {
1126
+ type: "object"
1127
+ },
1128
+ /**
1129
+ * Pass custom headers
1130
+ */
1131
+ headers: {
1132
+ type: "object"
1133
+ },
1134
+ /**
1135
+ * Function transforming the request options before the request is made
1136
+ */
1137
+ transformRequest: {
1138
+ type: "function",
1139
+ default: (requestOptions) => requestOptions
1140
+ },
1141
+ /**
1142
+ * Function transforming the response object after it is received
1143
+ */
1144
+ transformResponse: {
1145
+ type: "function",
1146
+ default: (response) => response
1147
+ },
1148
+ /**
1149
+ * Appium direct connect options server (https://appiumpro.com/editions/86-connecting-directly-to-appium-hosts-in-distributed-environments)
1150
+ * Whether to allow direct connect caps to adjust endpoint details (Appium only)
1151
+ */
1152
+ enableDirectConnect: {
1153
+ type: "boolean",
1154
+ default: true
1155
+ },
1156
+ /**
1157
+ * Whether it requires SSL certificates to be valid in HTTP/s requests
1158
+ * for an environment which cannot get process environment well.
1159
+ */
1160
+ strictSSL: {
1161
+ type: "boolean",
1162
+ default: true
1163
+ },
1164
+ /**
1165
+ * The path to the root of the cache directory. This directory is used to store all drivers that are downloaded
1166
+ * when attempting to start a session.
1167
+ */
1168
+ cacheDir: {
1169
+ type: "string",
1170
+ default: process.env.WEBDRIVER_CACHE_DIR || os.tmpdir()
1171
+ }
1172
+ };
1173
+ var ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
1174
+ var SHADOW_ELEMENT_KEY = "shadow-6066-11e4-a52e-4f735466cecf";
1175
+
1152
1176
  // package.json
1153
1177
  var package_default = {
1154
1178
  name: "webdriver",
1155
- version: "9.1.0",
1179
+ version: "9.1.1",
1156
1180
  description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
1157
1181
  author: "Christian Bromann <mail@bromann.dev>",
1158
1182
  homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -1202,11 +1226,6 @@ var ERRORS_TO_EXCLUDE_FROM_RETRY = [
1202
1226
  "detached shadow root",
1203
1227
  "move target out of bounds"
1204
1228
  ];
1205
- var RequestLibError = class extends Error {
1206
- statusCode;
1207
- body;
1208
- code;
1209
- };
1210
1229
  var COMMANDS_WITHOUT_RETRY = [
1211
1230
  findCommandPathByName("performActions")
1212
1231
  ];
@@ -1298,9 +1317,9 @@ var WebDriverRequest = class extends EventEmitter {
1298
1317
  if (this.#requestTimeout) {
1299
1318
  clearTimeout(this.#requestTimeout);
1300
1319
  }
1301
- const retry = (error2, msg) => {
1320
+ const retry = (error2) => {
1302
1321
  if (retryCount >= totalRetryCount || error2.message.includes("invalid session id")) {
1303
- log3.error(`Request failed with status ${response.statusCode} due to ${error2}`);
1322
+ log3.error(error2.message);
1304
1323
  this.emit("response", { error: error2 });
1305
1324
  this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1306
1325
  throw error2;
@@ -1308,20 +1327,14 @@ var WebDriverRequest = class extends EventEmitter {
1308
1327
  ++retryCount;
1309
1328
  this.emit("retry", { error: error2, retryCount });
1310
1329
  this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1311
- log3.warn(msg);
1330
+ log3.warn(error2.message);
1312
1331
  log3.info(`Retrying ${retryCount}/${totalRetryCount}`);
1313
1332
  return this._request(url, fullRequestOptions, transformResponse, totalRetryCount, retryCount);
1314
1333
  };
1315
1334
  if (response instanceof Error) {
1316
- const errorCode = response.code;
1317
- if (errorCode && RETRYABLE_ERROR_CODES.includes(errorCode)) {
1318
- const error2 = getRequestError(response, fullRequestOptions, url);
1319
- return retry(error2, 'Request timed out! Consider increasing the "connectionRetryTimeout" option.');
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);
1335
+ const resError = response;
1336
+ if (resError.code && RETRYABLE_ERROR_CODES.includes(resError.code) || resError.statusCode && RETRYABLE_STATUS_CODES.includes(resError.statusCode)) {
1337
+ return retry(resError);
1325
1338
  }
1326
1339
  this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
1327
1340
  throw response;
@@ -1329,10 +1342,12 @@ var WebDriverRequest = class extends EventEmitter {
1329
1342
  if (typeof transformResponse === "function") {
1330
1343
  response = transformResponse(response, fullRequestOptions);
1331
1344
  }
1332
- const error = getErrorFromResponseBody(response.body, fullRequestOptions.body);
1333
- if (error.message === "java.net.ConnectException: Connection refused: connect") {
1334
- return retry(error, "Connection to Selenium Standalone server was refused.");
1345
+ if (isSuccessfulResponse(response.statusCode, response.body)) {
1346
+ this.emit("response", { result: response.body });
1347
+ this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
1348
+ return response.body;
1335
1349
  }
1350
+ const error = new WebDriverResponseError(response, url, fullRequestOptions);
1336
1351
  if (this.isHubCommand) {
1337
1352
  if (typeof response.body === "string" && response.body.startsWith("<!DOCTYPE html>")) {
1338
1353
  this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
@@ -1340,11 +1355,6 @@ var WebDriverRequest = class extends EventEmitter {
1340
1355
  }
1341
1356
  return { value: response.body || null };
1342
1357
  }
1343
- if (isSuccessfulResponse(response.statusCode, response.body)) {
1344
- this.emit("response", { result: response.body });
1345
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
1346
- return response.body;
1347
- }
1348
1358
  if (error.name === "stale element reference") {
1349
1359
  log3.warn("Request encountered a stale element - terminating request");
1350
1360
  this.emit("response", { error });
@@ -1354,7 +1364,7 @@ var WebDriverRequest = class extends EventEmitter {
1354
1364
  if (ERRORS_TO_EXCLUDE_FROM_RETRY.includes(error.name)) {
1355
1365
  throw error;
1356
1366
  }
1357
- return retry(error, `Request failed with status ${response.statusCode} due to ${error.message}`);
1367
+ return retry(error);
1358
1368
  }
1359
1369
  };
1360
1370
  function findCommandPathByName(commandName) {
@@ -1392,9 +1402,13 @@ var FetchRequest = class extends WebDriverRequest {
1392
1402
  };
1393
1403
  } catch (err) {
1394
1404
  if (!(err instanceof Error)) {
1395
- throw new RequestLibError(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`);
1405
+ throw new WebDriverRequestError(
1406
+ new Error(`Failed to fetch ${url.href}: ${err.message || err || "Unknown error"}`),
1407
+ url,
1408
+ opts
1409
+ );
1396
1410
  }
1397
- throw err;
1411
+ throw new WebDriverRequestError(err, url, opts);
1398
1412
  }
1399
1413
  }
1400
1414
  _libPerformanceNow() {
@@ -1640,7 +1654,6 @@ export {
1640
1654
  BidiHandler,
1641
1655
  DEFAULTS,
1642
1656
  ELEMENT_KEY,
1643
- REG_EXPS,
1644
1657
  SHADOW_ELEMENT_KEY,
1645
1658
  command_default as command,
1646
1659
  WebDriver as default,
@@ -6,4 +6,8 @@ export declare const RETRYABLE_STATUS_CODES: number[];
6
6
  * retrieved from https://github.com/sindresorhus/got/blob/89b7fdfd4e7ea4e76258f50b70ae8a1d2aea8125/source/core/options.ts#L392C1-L399C37
7
7
  */
8
8
  export declare const RETRYABLE_ERROR_CODES: string[];
9
+ export declare const REG_EXPS: {
10
+ commandName: RegExp;
11
+ execFn: RegExp;
12
+ };
9
13
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +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
+ {"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,UAKjC,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA"}
@@ -0,0 +1,25 @@
1
+ import type { Options } from '@wdio/types';
2
+ declare abstract class WebDriverError extends Error {
3
+ #private;
4
+ abstract url: URL;
5
+ abstract opts: RequestInit;
6
+ /**
7
+ * return timeout error with information about the executing command on which the test hangs
8
+ */
9
+ computeErrorMessage(): string;
10
+ }
11
+ export declare class WebDriverRequestError extends WebDriverError {
12
+ url: URL;
13
+ opts: RequestInit;
14
+ statusCode?: number;
15
+ body?: any;
16
+ code?: string;
17
+ constructor(err: Error, url: URL, opts: RequestInit);
18
+ }
19
+ export declare class WebDriverResponseError extends WebDriverError {
20
+ url: URL;
21
+ opts: RequestInit;
22
+ constructor(response: Options.RequestLibResponse, url: URL, opts: RequestInit);
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/request/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG1C,uBAAe,cAAe,SAAQ,KAAK;;IACvC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;IACjB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAE1B;;OAEG;IACH,mBAAmB;CAsCtB;AAED,qBAAa,qBAAsB,SAAQ,cAAc;IACrD,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,WAAW,CAAA;IAEjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;gBAEA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW;CAwBvD;AAED,qBAAa,sBAAuB,SAAQ,cAAc;IACtD,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,WAAW,CAAA;gBACJ,QAAQ,EAAE,OAAO,CAAC,kBAAkB,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW;CAyDjF"}
@@ -1,28 +1,9 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { URL } from 'node:url';
3
3
  import type { Options } from '@wdio/types';
4
+ import type { WebDriverResponse } from './types.js';
4
5
  type RequestLibResponse = Options.RequestLibResponse;
5
6
  type RequestOptions = Omit<Options.WebDriver, 'capabilities'>;
6
- export declare class RequestLibError extends Error {
7
- statusCode?: number;
8
- body?: any;
9
- code?: string;
10
- }
11
- export interface WebDriverResponse {
12
- value: any;
13
- /**
14
- * error case
15
- * https://w3c.github.io/webdriver/webdriver-spec.html#dfn-send-an-error
16
- */
17
- error?: string;
18
- message?: string;
19
- stacktrace?: string;
20
- /**
21
- * JSONWP property
22
- */
23
- status?: number;
24
- sessionId?: string;
25
- }
26
7
  export declare const COMMANDS_WITHOUT_RETRY: string[];
27
8
  export default abstract class WebDriverRequest extends EventEmitter {
28
9
  #private;
@@ -1 +1 @@
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AAO,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;CA4HzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,gBAAqC,MAAM,YAAY,CAAA;AAQ9D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;gBACzC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;cAI5F,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAwB9F,SAAS,CAAC,kBAAkB,IAAI,MAAM;CAGzC"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,gBAAgB,MAAM,YAAY,CAAA;AASzC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;gBACzC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;cAI5F,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;IA6B9F,SAAS,CAAC,kBAAkB,IAAI,MAAM;CAGzC"}
@@ -0,0 +1,16 @@
1
+ export interface WebDriverResponse {
2
+ value: any;
3
+ /**
4
+ * error case
5
+ * https://w3c.github.io/webdriver/webdriver-spec.html#dfn-send-an-error
6
+ */
7
+ error?: string;
8
+ message?: string;
9
+ stacktrace?: string;
10
+ /**
11
+ * JSONWP property
12
+ */
13
+ status?: number;
14
+ sessionId?: string;
15
+ }
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request/types.ts"],"names":[],"mappings":"AAAA,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"}
package/build/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { EventEmitter } from 'node:events';
2
2
  import type { Options } from '@wdio/types';
3
- import type { WebDriverResponse } from './request/index.js';
3
+ import type { WebDriverResponse } from './request/types.js';
4
4
  import type { Client, JSONWPCommandError, SessionFlags, RemoteConfig } from './types.js';
5
5
  /**
6
6
  * start browser session with WebDriver protocol
@@ -27,15 +27,6 @@ export declare function isSuccessfulResponse(statusCode?: number, body?: WebDriv
27
27
  * creates the base prototype for the webdriver monad
28
28
  */
29
29
  export declare function getPrototype({ isW3C, isChromium, isFirefox, isMobile, isSauce, isSeleniumStandalone }: Partial<SessionFlags>): Record<string, PropertyDescriptor>;
30
- /**
31
- * helper method to determine the error from webdriver response
32
- * @param {Object} body body object
33
- * @return {Object} error
34
- */
35
- export declare function getErrorFromResponseBody(body: any, requestOptions: any): Error;
36
- export declare class CustomRequestError extends Error {
37
- constructor(body: WebDriverResponse, requestOptions: any);
38
- }
39
30
  /**
40
31
  * return all supported flags and return them in a format so we can attach them
41
32
  * to the instance protocol
@@ -55,10 +46,6 @@ export declare function setupDirectConnect(client: Client): void;
55
46
  * @param {Error} err response error
56
47
  */
57
48
  export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string;
58
- /**
59
- * return timeout error with information about the executing command on which the test hangs
60
- */
61
- export declare function getRequestError(error: Error, requestOptions: RequestInit, url: URL): Error;
62
49
  /**
63
50
  * Enhance the monad with WebDriver Bidi primitives if a connection can be established successfully
64
51
  * @param socketUrl url to bidi interface
@@ -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,CAyDzI;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAE,YAAY,EAAE,WAAW,CAAC,YAAY,QAiC3E;AAED;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AAc,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.1.1",
3
+ "version": "9.1.2",
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.1.0",
38
+ "@wdio/config": "9.1.2",
39
39
  "@wdio/logger": "9.1.0",
40
40
  "@wdio/protocols": "9.0.8",
41
- "@wdio/types": "9.1.0",
42
- "@wdio/utils": "9.1.0",
41
+ "@wdio/types": "9.1.2",
42
+ "@wdio/utils": "9.1.2",
43
43
  "deepmerge-ts": "^7.0.3",
44
44
  "ws": "^8.8.0"
45
45
  },
46
- "gitHead": "f70367e464d7c056328cd7d8e57ea296c0e766ae"
46
+ "gitHead": "e009b5102f9f98b99fa62df870ce7f3f5bc1b99a"
47
47
  }