webdriver 9.16.2 → 9.17.0

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 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAI7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAwB,MAAM,YAAY,CAAA;AAS/F,MAAM,CAAC,OAAO,WACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,EAC5B,qBAAqB,UAAQ,UAIgB,UAAU,mBAAmB,OAAO,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CAqN1I"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAI7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAwB,MAAM,YAAY,CAAA;AAS/F,MAAM,CAAC,OAAO,WACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,EAC5B,qBAAqB,UAAQ,IAIU,MAAM,UAAU,EAAE,GAAG,cAAc,OAAO,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CA+L1I"}
@@ -1,4 +1,5 @@
1
1
  import type WebSocket from 'ws';
2
+ import type { Options } from '@wdio/types';
2
3
  import type { BrowserSocket } from './bidi/socket.js';
3
4
  import type { FetchRequest } from './request/web.js';
4
5
  /**
@@ -7,13 +8,18 @@ import type { FetchRequest } from './request/web.js';
7
8
  export declare const isNode: boolean;
8
9
  export interface EnvironmentVariables {
9
10
  WEBDRIVER_CACHE_DIR?: string;
11
+ WDIO_LOG_LEVEL?: Options.WebDriverLogTypes;
10
12
  PROXY_URL?: string;
11
13
  NO_PROXY?: string[];
14
+ DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS?: string;
15
+ WDIO_WORKER_ID?: string;
16
+ WDIO_UNIT_TESTS?: string;
12
17
  }
13
18
  export interface EnvironmentDependencies {
14
19
  Request: typeof FetchRequest;
15
20
  Socket: typeof BrowserSocket;
16
21
  createBidiConnection: (wsUrl?: string, options?: WebSocket.ClientOptions) => Promise<WebSocket | undefined>;
22
+ killDriverProcess: (capabilities: WebdriverIO.Capabilities, shutdownDriver: boolean) => void;
17
23
  variables: EnvironmentVariables;
18
24
  }
19
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,IAAI,CAAA;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,MAAM,SAAwD,CAAA;AAE3E,MAAM,WAAW,oBAAoB;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,YAAY,CAAC;IAC7B,MAAM,EAAE,OAAO,aAAa,CAAC;IAC7B,oBAAoB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,aAAa,KAAK,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAC5G,SAAS,EAA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AY,CAAC,EAAE,WAAW,CAAA;KAAE,EAAE,eAAe,CAAC,EAAE,WAAW,CAAC,YAAY;IA2DxH,MAAM,KAAK,SAAS,qBAEnB;CACJ;AAED;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAA;AACzG,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA"}
package/build/index.js CHANGED
@@ -44,6 +44,9 @@ var environment = {
44
44
  get createBidiConnection() {
45
45
  throw new Error("createBidiConnection is not available in this environment");
46
46
  },
47
+ get killDriverProcess() {
48
+ throw new Error("killDriverProcess is not available in this environment");
49
+ },
47
50
  get variables() {
48
51
  return {};
49
52
  }
@@ -1256,7 +1259,7 @@ var getSessionError = (err, params = {}) => {
1256
1259
  return err.message;
1257
1260
  };
1258
1261
  function initiateBidi(socketUrl, strictSSL = true, userHeaders) {
1259
- const isUnitTesting = process.env.WDIO_UNIT_TESTS;
1262
+ const isUnitTesting = environment.value.variables.WDIO_UNIT_TESTS;
1260
1263
  if (isUnitTesting) {
1261
1264
  log2.info("Skip connecting to WebDriver Bidi interface due to unit tests");
1262
1265
  return {
@@ -1356,7 +1359,7 @@ function command_default(method, endpointUri, commandInfo, doubleEncodeVariables
1356
1359
  })), ...parameters];
1357
1360
  const commandUsage = "".concat(command, "(").concat(commandParams.map((p) => p.name).join(", "), ")");
1358
1361
  const moreInfo = "\n\nFor more info see ".concat(ref, "\n");
1359
- if (typeof deprecated === "string" && !process.env.DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS) {
1362
+ if (typeof deprecated === "string" && !environment.value.variables.DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS) {
1360
1363
  const warning = deprecated.replace("This command", 'The "'.concat(command, '" command'));
1361
1364
  log3.warn(warning);
1362
1365
  console.warn("\u26A0\uFE0F [WEBDRIVERIO DEPRECATION NOTICE] ".concat(warning));
@@ -1431,25 +1434,8 @@ function command_default(method, endpointUri, commandInfo, doubleEncodeVariables
1431
1434
  const browser = this;
1432
1435
  (_a = browser._bidiHandler) == null ? void 0 : _a.close();
1433
1436
  const shutdownDriver = ((_b = maskedBody.deleteSessionOpts) == null ? void 0 : _b.shutdownDriver) !== false;
1434
- if (shutdownDriver && "wdio:driverPID" in this.capabilities && this.capabilities["wdio:driverPID"]) {
1435
- log3.info("Kill driver process with PID ".concat(this.capabilities["wdio:driverPID"]));
1436
- try {
1437
- const killedSuccessfully = process.kill(this.capabilities["wdio:driverPID"], "SIGKILL");
1438
- if (!killedSuccessfully) {
1439
- log3.warn("Failed to kill driver process, manually clean-up might be required");
1440
- }
1441
- } catch (err) {
1442
- log3.warn("Failed to kill driver process", err);
1443
- }
1444
- setTimeout(() => {
1445
- for (const handle of process._getActiveHandles()) {
1446
- if (handle.servername && handle.servername.includes("edgedl.me")) {
1447
- handle.destroy();
1448
- }
1449
- }
1450
- }, 10);
1451
- }
1452
- if (!process.env.WDIO_WORKER_ID) {
1437
+ environment.value.killDriverProcess(this.capabilities, shutdownDriver);
1438
+ if (!environment.value.variables.WDIO_WORKER_ID) {
1453
1439
  logger3.clearLogger();
1454
1440
  }
1455
1441
  }
@@ -1509,7 +1495,7 @@ var log4 = logger4("webdriver");
1509
1495
  var WebDriver = class _WebDriver {
1510
1496
  static async newSession(options, modifier, userPrototype = {}, customCommandWrapper) {
1511
1497
  var _a;
1512
- const envLogLevel = process.env.WDIO_LOG_LEVEL;
1498
+ const envLogLevel = environment.value.variables.WDIO_LOG_LEVEL;
1513
1499
  options.logLevel = envLogLevel != null ? envLogLevel : options.logLevel;
1514
1500
  const params = validateConfig(DEFAULTS, options);
1515
1501
  if (params.logLevel && (!options.logLevels || !options.logLevels.webdriver)) {
@@ -1805,7 +1791,7 @@ var WebDriverResponseError = class _WebDriverResponseError extends WebDriverErro
1805
1791
  // package.json
1806
1792
  var package_default = {
1807
1793
  name: "webdriver",
1808
- version: "9.16.0",
1794
+ version: "9.16.2",
1809
1795
  description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
1810
1796
  author: "Christian Bromann <mail@bromann.dev>",
1811
1797
  homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -1849,6 +1835,7 @@ var package_default = {
1849
1835
  "@wdio/types": "workspace:*",
1850
1836
  "@wdio/utils": "workspace:*",
1851
1837
  "deepmerge-ts": "^7.0.3",
1838
+ "https-proxy-agent": "^7.0.6",
1852
1839
  undici: "^6.20.1",
1853
1840
  ws: "^8.8.0"
1854
1841
  }
@@ -1938,7 +1925,7 @@ var WebDriverRequest = class {
1938
1925
  });
1939
1926
  const searchParams = isBrowser ? void 0 : typeof options.queryParams === "object" ? options.queryParams : void 0;
1940
1927
  if (this.body && (Object.keys(this.body).length || this.method === "POST")) {
1941
- const contentLength = Buffer.byteLength(JSON.stringify(this.body), "utf8");
1928
+ const contentLength = new TextEncoder().encode(JSON.stringify(this.body)).length;
1942
1929
  requestOptions.body = this.body;
1943
1930
  requestHeaders.set("Content-Length", "".concat(contentLength));
1944
1931
  }
@@ -2067,6 +2054,8 @@ var log6 = logger6("webdriver");
2067
2054
  environment.value = {
2068
2055
  Request: FetchRequest,
2069
2056
  Socket: BrowserSocket,
2057
+ killDriverProcess: () => {
2058
+ },
2070
2059
  createBidiConnection: (webSocketUrl, options) => {
2071
2060
  log6.info("Connecting to webSocketUrl ".concat(webSocketUrl));
2072
2061
  const ws = new BrowserSocket(webSocketUrl, options);
@@ -1 +1 @@
1
- {"version":3,"file":"bidi.d.ts","sourceRoot":"","sources":["../../src/node/bidi.ts"],"names":[],"mappings":"AAMA,OAAO,SAAS,EAAE,EAAE,KAAK,aAAa,EAAE,MAAM,IAAI,CAAA;AAKlD,wBAAsB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAGxH;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAqBxF;AAcD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAsDvH"}
1
+ {"version":3,"file":"bidi.d.ts","sourceRoot":"","sources":["../../src/node/bidi.ts"],"names":[],"mappings":"AASA,OAAO,SAAS,EAAE,EAAE,KAAK,aAAa,EAAE,MAAM,IAAI,CAAA;AAMlD,wBAAsB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAGxH;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAqBxF;AAcD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAuEvH"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Kill the driver process after `deleteSession` command is done
3
+ * @param capabilities - the capabilities of the driver
4
+ * @param shutdownDriver - whether to shutdown the driver
5
+ */
6
+ export declare function killDriverProcess(capabilities: WebdriverIO.Capabilities, shutdownDriver: boolean): void;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/node/utils.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE,cAAc,EAAE,OAAO,QAwBhG"}
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,YAAY,CAAA;AAMlC,eAAe,SAAS,CAAA;AACxB,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAIA,OAAO,SAAS,MAAM,YAAY,CAAA;AAOlC,eAAe,SAAS,CAAA;AACxB,cAAc,YAAY,CAAA"}
package/build/node.js CHANGED
@@ -25,6 +25,9 @@ var environment = {
25
25
  get createBidiConnection() {
26
26
  throw new Error("createBidiConnection is not available in this environment");
27
27
  },
28
+ get killDriverProcess() {
29
+ throw new Error("killDriverProcess is not available in this environment");
30
+ },
28
31
  get variables() {
29
32
  return {};
30
33
  }
@@ -1226,7 +1229,7 @@ It seems like the service failed to start or is rejecting any connections.`;
1226
1229
  return err.message;
1227
1230
  };
1228
1231
  function initiateBidi(socketUrl, strictSSL = true, userHeaders) {
1229
- const isUnitTesting = process.env.WDIO_UNIT_TESTS;
1232
+ const isUnitTesting = environment.value.variables.WDIO_UNIT_TESTS;
1230
1233
  if (isUnitTesting) {
1231
1234
  log2.info("Skip connecting to WebDriver Bidi interface due to unit tests");
1232
1235
  return {
@@ -1328,7 +1331,7 @@ function command_default(method, endpointUri, commandInfo, doubleEncodeVariables
1328
1331
 
1329
1332
  For more info see ${ref}
1330
1333
  `;
1331
- if (typeof deprecated === "string" && !process.env.DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS) {
1334
+ if (typeof deprecated === "string" && !environment.value.variables.DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS) {
1332
1335
  const warning = deprecated.replace("This command", `The "${command}" command`);
1333
1336
  log3.warn(warning);
1334
1337
  console.warn(`\u26A0\uFE0F [WEBDRIVERIO DEPRECATION NOTICE] ${warning}`);
@@ -1408,25 +1411,8 @@ Actual: ${actual}` + moreInfo
1408
1411
  const browser = this;
1409
1412
  browser._bidiHandler?.close();
1410
1413
  const shutdownDriver = maskedBody.deleteSessionOpts?.shutdownDriver !== false;
1411
- if (shutdownDriver && "wdio:driverPID" in this.capabilities && this.capabilities["wdio:driverPID"]) {
1412
- log3.info(`Kill driver process with PID ${this.capabilities["wdio:driverPID"]}`);
1413
- try {
1414
- const killedSuccessfully = process.kill(this.capabilities["wdio:driverPID"], "SIGKILL");
1415
- if (!killedSuccessfully) {
1416
- log3.warn("Failed to kill driver process, manually clean-up might be required");
1417
- }
1418
- } catch (err) {
1419
- log3.warn("Failed to kill driver process", err);
1420
- }
1421
- setTimeout(() => {
1422
- for (const handle of process._getActiveHandles()) {
1423
- if (handle.servername && handle.servername.includes("edgedl.me")) {
1424
- handle.destroy();
1425
- }
1426
- }
1427
- }, 10);
1428
- }
1429
- if (!process.env.WDIO_WORKER_ID) {
1414
+ environment.value.killDriverProcess(this.capabilities, shutdownDriver);
1415
+ if (!environment.value.variables.WDIO_WORKER_ID) {
1430
1416
  logger3.clearLogger();
1431
1417
  }
1432
1418
  }
@@ -1485,7 +1471,7 @@ var remoteTypes_exports = {};
1485
1471
  var log4 = logger4("webdriver");
1486
1472
  var WebDriver = class _WebDriver {
1487
1473
  static async newSession(options, modifier, userPrototype = {}, customCommandWrapper) {
1488
- const envLogLevel = process.env.WDIO_LOG_LEVEL;
1474
+ const envLogLevel = environment.value.variables.WDIO_LOG_LEVEL;
1489
1475
  options.logLevel = envLogLevel ?? options.logLevel;
1490
1476
  const params = validateConfig(DEFAULTS, options);
1491
1477
  if (params.logLevel && (!options.logLevels || !options.logLevels.webdriver)) {
@@ -1624,7 +1610,7 @@ var WebDriver = class _WebDriver {
1624
1610
 
1625
1611
  // src/request/node.ts
1626
1612
  import dns from "node:dns";
1627
- import { fetch as fetch2, Agent, ProxyAgent } from "undici";
1613
+ import { fetch as fetch2, Agent, ProxyAgent, getGlobalDispatcher } from "undici";
1628
1614
 
1629
1615
  // src/request/request.ts
1630
1616
  import logger5 from "@wdio/logger";
@@ -1736,7 +1722,7 @@ var WebDriverResponseError = class _WebDriverResponseError extends WebDriverErro
1736
1722
  // package.json
1737
1723
  var package_default = {
1738
1724
  name: "webdriver",
1739
- version: "9.16.0",
1725
+ version: "9.16.2",
1740
1726
  description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
1741
1727
  author: "Christian Bromann <mail@bromann.dev>",
1742
1728
  homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -1780,6 +1766,7 @@ var package_default = {
1780
1766
  "@wdio/types": "workspace:*",
1781
1767
  "@wdio/utils": "workspace:*",
1782
1768
  "deepmerge-ts": "^7.0.3",
1769
+ "https-proxy-agent": "^7.0.6",
1783
1770
  undici: "^6.20.1",
1784
1771
  ws: "^8.8.0"
1785
1772
  }
@@ -1868,7 +1855,7 @@ var WebDriverRequest = class {
1868
1855
  });
1869
1856
  const searchParams = isBrowser ? void 0 : typeof options.queryParams === "object" ? options.queryParams : void 0;
1870
1857
  if (this.body && (Object.keys(this.body).length || this.method === "POST")) {
1871
- const contentLength = Buffer.byteLength(JSON.stringify(this.body), "utf8");
1858
+ const contentLength = new TextEncoder().encode(JSON.stringify(this.body)).length;
1872
1859
  requestOptions.body = this.body;
1873
1860
  requestHeaders.set("Content-Length", `${contentLength}`);
1874
1861
  }
@@ -2000,6 +1987,14 @@ var FetchRequest = class extends WebDriverRequest {
2000
1987
  if (sessionId && SESSION_DISPATCHERS.has(sessionId)) {
2001
1988
  return SESSION_DISPATCHERS.get(sessionId);
2002
1989
  }
1990
+ try {
1991
+ const globalDispatcher = getGlobalDispatcher();
1992
+ if (globalDispatcher && (globalDispatcher.constructor.name === "ProxyAgent" || "proxy" in globalDispatcher || // Also check for other custom dispatcher types
1993
+ globalDispatcher.constructor.name !== "Agent" && globalDispatcher.constructor.name !== "MockAgent")) {
1994
+ return globalDispatcher;
1995
+ }
1996
+ } catch {
1997
+ }
2003
1998
  const { PROXY_URL, NO_PROXY } = environment.value.variables;
2004
1999
  const shouldUseProxy = PROXY_URL && !NO_PROXY?.some((str) => url.hostname.endsWith(str));
2005
2000
  const dispatcher = shouldUseProxy ? new ProxyAgent({
@@ -2043,6 +2038,7 @@ import { isIP } from "node:net";
2043
2038
  import dns2 from "node:dns/promises";
2044
2039
  import logger6 from "@wdio/logger";
2045
2040
  import WebSocket from "ws";
2041
+ import { HttpsProxyAgent } from "https-proxy-agent";
2046
2042
  var log6 = logger6("webdriver");
2047
2043
  var CONNECTION_TIMEOUT = 1e4;
2048
2044
  async function createBidiConnection(webSocketUrl, options) {
@@ -2070,7 +2066,20 @@ async function connectWebsocket(candidateUrls, options) {
2070
2066
  const websockets = candidateUrls.map((candidateUrl) => {
2071
2067
  log6.debug(`Attempt to connect to webSocketUrl ${candidateUrl}`);
2072
2068
  try {
2073
- const ws2 = new WebSocket(candidateUrl, options);
2069
+ const finalizedOptions = { ...options };
2070
+ const { PROXY_URL, NO_PROXY } = environment.value.variables;
2071
+ const shouldUseProxy = PROXY_URL && !NO_PROXY?.some((str) => {
2072
+ try {
2073
+ return new URL(candidateUrl).hostname.endsWith(str);
2074
+ } catch {
2075
+ return false;
2076
+ }
2077
+ });
2078
+ if (shouldUseProxy) {
2079
+ log6.debug(`Adding proxy ${PROXY_URL} for webSocketUrl ${candidateUrl}`);
2080
+ finalizedOptions.agent = new HttpsProxyAgent(PROXY_URL);
2081
+ }
2082
+ const ws2 = new WebSocket(candidateUrl, finalizedOptions);
2074
2083
  return ws2;
2075
2084
  } catch {
2076
2085
  return void 0;
@@ -2131,6 +2140,30 @@ function firstResolved(promises, errorMessages = []) {
2131
2140
  });
2132
2141
  }
2133
2142
 
2143
+ // src/node/utils.ts
2144
+ import logger7 from "@wdio/logger";
2145
+ var log7 = logger7("webdriver");
2146
+ function killDriverProcess(capabilities, shutdownDriver) {
2147
+ if (shutdownDriver && "wdio:driverPID" in capabilities && capabilities["wdio:driverPID"]) {
2148
+ log7.info(`Kill driver process with PID ${capabilities["wdio:driverPID"]}`);
2149
+ try {
2150
+ const killedSuccessfully = process.kill(capabilities["wdio:driverPID"], "SIGKILL");
2151
+ if (!killedSuccessfully) {
2152
+ log7.warn("Failed to kill driver process, manually clean-up might be required");
2153
+ }
2154
+ } catch (err) {
2155
+ log7.warn("Failed to kill driver process", err);
2156
+ }
2157
+ setTimeout(() => {
2158
+ for (const handle of process._getActiveHandles()) {
2159
+ if (handle.servername && handle.servername.includes("edgedl.me")) {
2160
+ handle.destroy();
2161
+ }
2162
+ }
2163
+ }, 10);
2164
+ }
2165
+ }
2166
+
2134
2167
  // src/node.ts
2135
2168
  var node_default = WebDriver;
2136
2169
  environment.value = {
@@ -2149,7 +2182,11 @@ environment.value = {
2149
2182
  ),
2150
2183
  Socket: ws,
2151
2184
  createBidiConnection,
2185
+ killDriverProcess,
2152
2186
  variables: {
2187
+ WDIO_LOG_LEVEL: process.env.WDIO_LOG_LEVEL,
2188
+ DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS: process.env.DISABLE_WEBDRIVERIO_DEPRECATION_WARNINGS,
2189
+ WDIO_UNIT_TESTS: process.env.WDIO_UNIT_TESTS,
2153
2190
  WEBDRIVER_CACHE_DIR: process.env.WEBDRIVER_CACHE_DIR || os.tmpdir(),
2154
2191
  PROXY_URL: process.env.HTTP_PROXY || process.env.HTTPS_PROXY,
2155
2192
  NO_PROXY: process.env.NO_PROXY && process.env.NO_PROXY.trim() ? process.env.NO_PROXY.trim().split(/[\s,;]+/) : []
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/request/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAmE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAA;AAGzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAMhD,eAAO,MAAM,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAa,CAAA;AAErE;;GAEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IACxC,KAAK,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW;IAcxC,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,wBAAwB;IAS1B,aAAa,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe;;;;CAM/F"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/request/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAmE,KAAK,UAAU,EAAuB,MAAM,QAAQ,CAAA;AAG9H,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAMhD,eAAO,MAAM,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAa,CAAA;AAErE;;GAEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IACxC,KAAK,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW;IAcxC,OAAO,CAAC,aAAa;IAqDrB,OAAO,CAAC,wBAAwB;IAS1B,aAAa,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe;;;;CAM/F"}
package/build/utils.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare const getSessionError: (err: JSONWPCommandError, params?: Partial
55
55
  * @returns prototype with interface for bidi primitives
56
56
  */
57
57
  export declare function initiateBidi(socketUrl: string, strictSSL?: boolean, userHeaders?: Record<string, string>): PropertyDescriptorMap;
58
- export declare function parseBidiMessage(this: EventEmitter, data: Buffer): void;
58
+ export declare function parseBidiMessage(this: EventEmitter, data: ArrayBuffer): void;
59
59
  /**
60
60
  * Masks the `text` parameter in a WebDriver command if masking is enabled in the options.
61
61
  *
@@ -1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EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,sCAiD7H;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,qBAAqB,CAuBpM;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,QAgBhD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,kBAAkB,EAAE,SAAQ,OAAO,CAAC,OAAO,CAAC,SAAS,CAAM,WAmD/F,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,OAAc,EACzB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,qBAAqB,CA6CvB;AAED,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,QAWtE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;;;;EA8BhI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webdriver",
3
- "version": "9.16.2",
3
+ "version": "9.17.0",
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",
@@ -38,14 +38,15 @@
38
38
  "dependencies": {
39
39
  "@types/node": "^20.1.0",
40
40
  "@types/ws": "^8.5.3",
41
- "@wdio/config": "9.16.2",
41
+ "@wdio/config": "9.17.0",
42
42
  "@wdio/logger": "9.16.2",
43
43
  "@wdio/protocols": "9.16.2",
44
44
  "@wdio/types": "9.16.2",
45
- "@wdio/utils": "9.16.2",
45
+ "@wdio/utils": "9.17.0",
46
46
  "deepmerge-ts": "^7.0.3",
47
+ "https-proxy-agent": "^7.0.6",
47
48
  "undici": "^6.20.1",
48
49
  "ws": "^8.8.0"
49
50
  },
50
- "gitHead": "ff2154c00e7ba6d6e2a58e0b8e1258a20229752d"
51
+ "gitHead": "796df04f0f5c744d5ef4bafd3759995fa4829d6f"
51
52
  }