webdriver 9.5.1 → 9.5.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 +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,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,OAAO,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CA6KlI"}
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,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,OAAO,EAAE,KAAG,OAAO,CAAC,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CAiLlI"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,aAAa,CAAA;AAExD,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OA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E,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
@@ -103,8 +103,12 @@ function command_default(method, endpointUri, commandInfo, doubleEncodeVariables
103
103
  }
104
104
  body[commandParams[i].name] = arg;
105
105
  }
106
- const request = new environment.value.Request(method, endpoint, body, isHubCommand);
107
- request.on("performance", (...args2) => this.emit("request.performance", ...args2));
106
+ const request = new environment.value.Request(method, endpoint, body, isHubCommand, {
107
+ onPerformance: (data) => this.emit("request.performance", data),
108
+ onRequest: (data) => this.emit("request.start", data),
109
+ onResponse: (data) => this.emit("request.end", data),
110
+ onRetry: (data) => this.emit("request.retry", data)
111
+ });
108
112
  this.emit("command", { command, method, endpoint, body });
109
113
  log.info("COMMAND", commandCallStructure(command, args));
110
114
  return request.makeRequest(this.options, this.sessionId).then((result) => {
@@ -181,8 +185,8 @@ var DEFAULTS = {
181
185
  */
182
186
  path: {
183
187
  type: "string",
184
- validate: (path2) => {
185
- if (!path2.startsWith("/")) {
188
+ validate: (path) => {
189
+ if (!path.startsWith("/")) {
186
190
  throw new TypeError('The option "path" needs to start with a "/"');
187
191
  }
188
192
  return true;
@@ -1354,7 +1358,7 @@ var WebDriver = class _WebDriver {
1354
1358
  * @returns {string} the new session id of the browser
1355
1359
  */
1356
1360
  static async reloadSession(instance, newCapabilities) {
1357
- var _a;
1361
+ var _a, _b;
1358
1362
  const capabilities = newCapabilities ? newCapabilities : Object.assign({}, instance.requestedCapabilities);
1359
1363
  let params = { ...instance.options, capabilities };
1360
1364
  for (const prop of ["protocol", "hostname", "port", "path", "queryParams", "user", "key"]) {
@@ -1389,6 +1393,7 @@ var WebDriver = class _WebDriver {
1389
1393
  if (isBidi(instance.capabilities || {})) {
1390
1394
  const bidiReqOpts = instance.options.strictSSL ? {} : { rejectUnauthorized: false };
1391
1395
  await ((_a = instance._bidiHandler) == null ? void 0 : _a.reconnect(newSessionCapabilities.webSocketUrl, bidiReqOpts));
1396
+ (_b = instance._bidiHandler) == null ? void 0 : _b.socket.on("message", parseBidiMessage.bind(instance));
1392
1397
  }
1393
1398
  return sessionId;
1394
1399
  }
@@ -1438,8 +1443,6 @@ _callbacks = new WeakMap();
1438
1443
  _ws2 = new WeakMap();
1439
1444
 
1440
1445
  // src/request/request.ts
1441
- import path from "node:path";
1442
- import { EventEmitter } from "node:events";
1443
1446
  import logger5 from "@wdio/logger";
1444
1447
  import { transformCommandLogResult as transformCommandLogResult2, sleep } from "@wdio/utils";
1445
1448
 
@@ -1555,7 +1558,7 @@ var WebDriverResponseError = class _WebDriverResponseError extends WebDriverErro
1555
1558
  // package.json
1556
1559
  var package_default = {
1557
1560
  name: "webdriver",
1558
- version: "9.5.0",
1561
+ version: "9.5.3",
1559
1562
  description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
1560
1563
  author: "Christian Bromann <mail@bromann.dev>",
1561
1564
  homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -1616,23 +1619,25 @@ var DEFAULT_HEADERS = {
1616
1619
  "User-Agent": "webdriver/" + package_default.version
1617
1620
  };
1618
1621
  var log5 = logger5("webdriver");
1619
- var WebDriverRequest = class extends EventEmitter {
1620
- constructor(method, endpoint, body, isHubCommand = false) {
1621
- super();
1622
+ var WebDriverRequest = class {
1623
+ constructor(method, endpoint, body, isHubCommand = false, eventHandler = {}) {
1622
1624
  __publicField(this, "body");
1623
1625
  __publicField(this, "method");
1624
1626
  __publicField(this, "endpoint");
1625
1627
  __publicField(this, "isHubCommand");
1626
1628
  __publicField(this, "requiresSessionId");
1629
+ __publicField(this, "eventHandler");
1627
1630
  this.body = body;
1628
1631
  this.method = method;
1629
1632
  this.endpoint = endpoint;
1630
1633
  this.isHubCommand = isHubCommand;
1631
1634
  this.requiresSessionId = Boolean(this.endpoint.match(/:sessionId/));
1635
+ this.eventHandler = eventHandler;
1632
1636
  }
1633
1637
  async makeRequest(options, sessionId) {
1638
+ var _a, _b;
1634
1639
  const { url, requestOptions } = await this.createOptions(options, sessionId);
1635
- this.emit("request", requestOptions);
1640
+ (_b = (_a = this.eventHandler).onRequest) == null ? void 0 : _b.call(_a, requestOptions);
1636
1641
  return this._request(url, requestOptions, options.transformResponse, options.connectionRetryCount, 0);
1637
1642
  }
1638
1643
  async createOptions(options, sessionId, isBrowser = false) {
@@ -1658,7 +1663,7 @@ var WebDriverRequest = class extends EventEmitter {
1658
1663
  }
1659
1664
  endpoint = endpoint.replace(":sessionId", sessionId);
1660
1665
  }
1661
- const url = new URL("".concat(options.protocol, "://").concat(options.hostname, ":").concat(options.port).concat(this.isHubCommand ? this.endpoint : path.join(options.path || "", endpoint)));
1666
+ const url = new URL("".concat(options.protocol, "://").concat(options.hostname, ":").concat(options.port).concat(this.isHubCommand ? this.endpoint : "".concat(options.path || "", "/").concat(endpoint).replace(/(\/){2,}/g, "/")));
1662
1667
  if (searchParams) {
1663
1668
  url.search = new URLSearchParams(searchParams).toString();
1664
1669
  }
@@ -1697,6 +1702,7 @@ var WebDriverRequest = class extends EventEmitter {
1697
1702
  }
1698
1703
  }
1699
1704
  async _request(url, fullRequestOptions, transformResponse, totalRetryCount = 0, retryCount = 0) {
1705
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1700
1706
  log5.info("[".concat(fullRequestOptions.method, "] ").concat(url.href));
1701
1707
  if (fullRequestOptions.body && Object.keys(fullRequestOptions.body).length) {
1702
1708
  log5.info("DATA", transformCommandLogResult2(fullRequestOptions.body));
@@ -1706,18 +1712,19 @@ var WebDriverRequest = class extends EventEmitter {
1706
1712
  let response = await this._libRequest(url, requestLibOptions).catch((err) => err);
1707
1713
  const durationMillisecond = performance.now() - startTime;
1708
1714
  const retry = async (error2) => {
1715
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
1709
1716
  if (retryCount >= totalRetryCount || error2.message.includes("invalid session id")) {
1710
1717
  log5.error(error2.message);
1711
- this.emit("response", { error: error2 });
1712
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1718
+ (_b2 = (_a2 = this.eventHandler).onResponse) == null ? void 0 : _b2.call(_a2, { error: error2 });
1719
+ (_d2 = (_c2 = this.eventHandler).onPerformance) == null ? void 0 : _d2.call(_c2, { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1713
1720
  throw error2;
1714
1721
  }
1715
1722
  if (retryCount > 0) {
1716
1723
  await sleep(Math.min(1e4, 250 * Math.pow(2, retryCount)));
1717
1724
  }
1718
1725
  ++retryCount;
1719
- this.emit("retry", { error: error2, retryCount });
1720
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1726
+ (_f2 = (_e2 = this.eventHandler).onRetry) == null ? void 0 : _f2.call(_e2, { error: error2, retryCount });
1727
+ (_h2 = (_g2 = this.eventHandler).onPerformance) == null ? void 0 : _h2.call(_g2, { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1721
1728
  log5.warn(error2.message);
1722
1729
  log5.info("Retrying ".concat(retryCount, "/").concat(totalRetryCount));
1723
1730
  return this._request(url, fullRequestOptions, transformResponse, totalRetryCount, retryCount);
@@ -1727,29 +1734,29 @@ var WebDriverRequest = class extends EventEmitter {
1727
1734
  if (resError.code && RETRYABLE_ERROR_CODES.includes(resError.code) || resError.statusCode && RETRYABLE_STATUS_CODES.includes(resError.statusCode)) {
1728
1735
  return retry(resError);
1729
1736
  }
1730
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
1737
+ (_b = (_a = this.eventHandler).onPerformance) == null ? void 0 : _b.call(_a, { request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
1731
1738
  throw response;
1732
1739
  }
1733
1740
  if (typeof transformResponse === "function") {
1734
1741
  response = transformResponse(response, fullRequestOptions);
1735
1742
  }
1736
1743
  if (isSuccessfulResponse(response.statusCode, response.body)) {
1737
- this.emit("response", { result: response.body });
1738
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
1744
+ (_d = (_c = this.eventHandler).onResponse) == null ? void 0 : _d.call(_c, { result: response.body });
1745
+ (_f = (_e = this.eventHandler).onPerformance) == null ? void 0 : _f.call(_e, { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
1739
1746
  return response.body;
1740
1747
  }
1741
1748
  const error = new WebDriverResponseError(response, url, fullRequestOptions);
1742
1749
  if (this.isHubCommand) {
1743
1750
  if (typeof response.body === "string" && response.body.startsWith("<!DOCTYPE html>")) {
1744
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1751
+ (_h = (_g = this.eventHandler).onPerformance) == null ? void 0 : _h.call(_g, { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1745
1752
  return Promise.reject(new Error("Command can only be called to a Selenium Hub"));
1746
1753
  }
1747
1754
  return { value: response.body || null };
1748
1755
  }
1749
1756
  if (error.name === "stale element reference") {
1750
1757
  log5.warn("Request encountered a stale element - terminating request");
1751
- this.emit("response", { error });
1752
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1758
+ (_j = (_i = this.eventHandler).onResponse) == null ? void 0 : _j.call(_i, { error });
1759
+ (_l = (_k = this.eventHandler).onPerformance) == null ? void 0 : _l.call(_k, { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1753
1760
  throw error;
1754
1761
  }
1755
1762
  if (ERRORS_TO_EXCLUDE_FROM_RETRY.includes(error.name)) {
package/build/node.js CHANGED
@@ -96,8 +96,12 @@ Actual: ${actual}` + moreInfo
96
96
  }
97
97
  body[commandParams[i].name] = arg;
98
98
  }
99
- const request = new environment.value.Request(method, endpoint, body, isHubCommand);
100
- request.on("performance", (...args2) => this.emit("request.performance", ...args2));
99
+ const request = new environment.value.Request(method, endpoint, body, isHubCommand, {
100
+ onPerformance: (data) => this.emit("request.performance", data),
101
+ onRequest: (data) => this.emit("request.start", data),
102
+ onResponse: (data) => this.emit("request.end", data),
103
+ onRetry: (data) => this.emit("request.retry", data)
104
+ });
101
105
  this.emit("command", { command, method, endpoint, body });
102
106
  log.info("COMMAND", commandCallStructure(command, args));
103
107
  return request.makeRequest(this.options, this.sessionId).then((result) => {
@@ -173,8 +177,8 @@ var DEFAULTS = {
173
177
  */
174
178
  path: {
175
179
  type: "string",
176
- validate: (path2) => {
177
- if (!path2.startsWith("/")) {
180
+ validate: (path) => {
181
+ if (!path.startsWith("/")) {
178
182
  throw new TypeError('The option "path" needs to start with a "/"');
179
183
  }
180
184
  return true;
@@ -1370,6 +1374,7 @@ var WebDriver = class _WebDriver {
1370
1374
  if (isBidi(instance.capabilities || {})) {
1371
1375
  const bidiReqOpts = instance.options.strictSSL ? {} : { rejectUnauthorized: false };
1372
1376
  await instance._bidiHandler?.reconnect(newSessionCapabilities.webSocketUrl, bidiReqOpts);
1377
+ instance._bidiHandler?.socket.on("message", parseBidiMessage.bind(instance));
1373
1378
  }
1374
1379
  return sessionId;
1375
1380
  }
@@ -1383,8 +1388,6 @@ import dns from "node:dns";
1383
1388
  import { fetch as fetch2, Agent, ProxyAgent } from "undici";
1384
1389
 
1385
1390
  // src/request/request.ts
1386
- import path from "node:path";
1387
- import { EventEmitter } from "node:events";
1388
1391
  import logger5 from "@wdio/logger";
1389
1392
  import { transformCommandLogResult as transformCommandLogResult2, sleep } from "@wdio/utils";
1390
1393
 
@@ -1494,7 +1497,7 @@ var WebDriverResponseError = class _WebDriverResponseError extends WebDriverErro
1494
1497
  // package.json
1495
1498
  var package_default = {
1496
1499
  name: "webdriver",
1497
- version: "9.5.0",
1500
+ version: "9.5.3",
1498
1501
  description: "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
1499
1502
  author: "Christian Bromann <mail@bromann.dev>",
1500
1503
  homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -1555,23 +1558,24 @@ var DEFAULT_HEADERS = {
1555
1558
  "User-Agent": "webdriver/" + package_default.version
1556
1559
  };
1557
1560
  var log5 = logger5("webdriver");
1558
- var WebDriverRequest = class extends EventEmitter {
1561
+ var WebDriverRequest = class {
1559
1562
  body;
1560
1563
  method;
1561
1564
  endpoint;
1562
1565
  isHubCommand;
1563
1566
  requiresSessionId;
1564
- constructor(method, endpoint, body, isHubCommand = false) {
1565
- super();
1567
+ eventHandler;
1568
+ constructor(method, endpoint, body, isHubCommand = false, eventHandler = {}) {
1566
1569
  this.body = body;
1567
1570
  this.method = method;
1568
1571
  this.endpoint = endpoint;
1569
1572
  this.isHubCommand = isHubCommand;
1570
1573
  this.requiresSessionId = Boolean(this.endpoint.match(/:sessionId/));
1574
+ this.eventHandler = eventHandler;
1571
1575
  }
1572
1576
  async makeRequest(options, sessionId) {
1573
1577
  const { url, requestOptions } = await this.createOptions(options, sessionId);
1574
- this.emit("request", requestOptions);
1578
+ this.eventHandler.onRequest?.(requestOptions);
1575
1579
  return this._request(url, requestOptions, options.transformResponse, options.connectionRetryCount, 0);
1576
1580
  }
1577
1581
  async createOptions(options, sessionId, isBrowser = false) {
@@ -1597,7 +1601,7 @@ var WebDriverRequest = class extends EventEmitter {
1597
1601
  }
1598
1602
  endpoint = endpoint.replace(":sessionId", sessionId);
1599
1603
  }
1600
- const url = new URL(`${options.protocol}://${options.hostname}:${options.port}${this.isHubCommand ? this.endpoint : path.join(options.path || "", endpoint)}`);
1604
+ const url = new URL(`${options.protocol}://${options.hostname}:${options.port}${this.isHubCommand ? this.endpoint : `${options.path || ""}/${endpoint}`.replace(/(\/){2,}/g, "/")}`);
1601
1605
  if (searchParams) {
1602
1606
  url.search = new URLSearchParams(searchParams).toString();
1603
1607
  }
@@ -1646,16 +1650,16 @@ var WebDriverRequest = class extends EventEmitter {
1646
1650
  const retry = async (error2) => {
1647
1651
  if (retryCount >= totalRetryCount || error2.message.includes("invalid session id")) {
1648
1652
  log5.error(error2.message);
1649
- this.emit("response", { error: error2 });
1650
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1653
+ this.eventHandler.onResponse?.({ error: error2 });
1654
+ this.eventHandler.onPerformance?.({ request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1651
1655
  throw error2;
1652
1656
  }
1653
1657
  if (retryCount > 0) {
1654
1658
  await sleep(Math.min(1e4, 250 * Math.pow(2, retryCount)));
1655
1659
  }
1656
1660
  ++retryCount;
1657
- this.emit("retry", { error: error2, retryCount });
1658
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1661
+ this.eventHandler.onRetry?.({ error: error2, retryCount });
1662
+ this.eventHandler.onPerformance?.({ request: fullRequestOptions, durationMillisecond, success: false, error: error2, retryCount });
1659
1663
  log5.warn(error2.message);
1660
1664
  log5.info(`Retrying ${retryCount}/${totalRetryCount}`);
1661
1665
  return this._request(url, fullRequestOptions, transformResponse, totalRetryCount, retryCount);
@@ -1665,29 +1669,29 @@ var WebDriverRequest = class extends EventEmitter {
1665
1669
  if (resError.code && RETRYABLE_ERROR_CODES.includes(resError.code) || resError.statusCode && RETRYABLE_STATUS_CODES.includes(resError.statusCode)) {
1666
1670
  return retry(resError);
1667
1671
  }
1668
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
1672
+ this.eventHandler.onPerformance?.({ request: fullRequestOptions, durationMillisecond, success: false, error: response, retryCount });
1669
1673
  throw response;
1670
1674
  }
1671
1675
  if (typeof transformResponse === "function") {
1672
1676
  response = transformResponse(response, fullRequestOptions);
1673
1677
  }
1674
1678
  if (isSuccessfulResponse(response.statusCode, response.body)) {
1675
- this.emit("response", { result: response.body });
1676
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: true, retryCount });
1679
+ this.eventHandler.onResponse?.({ result: response.body });
1680
+ this.eventHandler.onPerformance?.({ request: fullRequestOptions, durationMillisecond, success: true, retryCount });
1677
1681
  return response.body;
1678
1682
  }
1679
1683
  const error = new WebDriverResponseError(response, url, fullRequestOptions);
1680
1684
  if (this.isHubCommand) {
1681
1685
  if (typeof response.body === "string" && response.body.startsWith("<!DOCTYPE html>")) {
1682
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1686
+ this.eventHandler.onPerformance?.({ request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1683
1687
  return Promise.reject(new Error("Command can only be called to a Selenium Hub"));
1684
1688
  }
1685
1689
  return { value: response.body || null };
1686
1690
  }
1687
1691
  if (error.name === "stale element reference") {
1688
1692
  log5.warn("Request encountered a stale element - terminating request");
1689
- this.emit("response", { error });
1690
- this.emit("performance", { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1693
+ this.eventHandler.onResponse?.({ error });
1694
+ this.eventHandler.onPerformance?.({ request: fullRequestOptions, durationMillisecond, success: false, error, retryCount });
1691
1695
  throw error;
1692
1696
  }
1693
1697
  if (ERRORS_TO_EXCLUDE_FROM_RETRY.includes(error.name)) {
@@ -1,14 +1,14 @@
1
- import { EventEmitter } from 'node:events';
2
1
  import type { Options } from '@wdio/types';
3
- import type { WebDriverResponse, RequestLibResponse, RequestOptions } from './types.js';
4
- export declare abstract class WebDriverRequest extends EventEmitter {
2
+ import type { WebDriverResponse, RequestLibResponse, RequestOptions, RequestEventHandler } from './types.js';
3
+ export declare abstract class WebDriverRequest {
5
4
  protected abstract fetch(url: URL, opts: RequestInit): Promise<Response>;
6
5
  body?: Record<string, unknown>;
7
6
  method: string;
8
7
  endpoint: string;
9
8
  isHubCommand: boolean;
10
9
  requiresSessionId: boolean;
11
- constructor(method: string, endpoint: string, body?: Record<string, unknown>, isHubCommand?: boolean);
10
+ eventHandler: RequestEventHandler;
11
+ constructor(method: string, endpoint: string, body?: Record<string, unknown>, isHubCommand?: boolean, eventHandler?: RequestEventHandler);
12
12
  makeRequest(options: RequestOptions, sessionId?: string): Promise<WebDriverResponse<unknown>>;
13
13
  createOptions(options: RequestOptions, sessionId?: string, isBrowser?: boolean): Promise<{
14
14
  url: URL;
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAoBvF,8BAAsB,gBAAiB,SAAQ,YAAY;IACvD,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAExE,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;gBAEb,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;IAStG,WAAW,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM;IAMxD,aAAa,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;cA2DhI,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;cA6B9E,QA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,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;cA6B9E,QAAQ,CACpB,GAAG,EAAE,GAAG,EACR,kBAAkB,EAAE,WAAW,EAC/B,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,KAAK,kBAAkB,EACrG,eAAe,SAAI,EACnB,UAAU,SAAI,GACf,OAAO,CAAC,iBAAiB,CAAC;CA0HhC"}
@@ -16,4 +16,26 @@ export interface WebDriverResponse<T = unknown> {
16
16
  }
17
17
  export type RequestLibResponse = Options.RequestLibResponse;
18
18
  export type RequestOptions = Omit<Options.WebDriver, 'capabilities'>;
19
+ export interface RequestEventHandler {
20
+ onRequest?: (ev: RequestStartEvent) => void;
21
+ onResponse?: (ev: RequestEndEvent) => void;
22
+ onRetry?: (ev: RequestRetryEvent) => void;
23
+ onPerformance?: (ev: RequestPerformanceEvent) => void;
24
+ }
25
+ export type RequestStartEvent = RequestInit;
26
+ export type RequestEndEvent = {
27
+ result?: unknown;
28
+ error?: Error;
29
+ };
30
+ export type RequestRetryEvent = {
31
+ error: Error;
32
+ retryCount: number;
33
+ };
34
+ export type RequestPerformanceEvent = {
35
+ request: RequestInit;
36
+ durationMillisecond: number;
37
+ success: boolean;
38
+ error?: Error;
39
+ retryCount: number;
40
+ };
19
41
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC1C,KAAK,EAAE,CAAC,CAAA;IACR;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,M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AK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AACpE,MAAM,MAAM,uBAAuB,GAAG;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA"}
package/build/types.d.ts CHANGED
@@ -5,6 +5,7 @@ import type { BidiHandler } from './bidi/handler.js';
5
5
  import type { EventData } from './bidi/localTypes.js';
6
6
  import type { CommandData } from './bidi/remoteTypes.js';
7
7
  import type { CommandResponse } from './bidi/localTypes.js';
8
+ import type { RequestStartEvent, RequestEndEvent, RequestPerformanceEvent, RequestRetryEvent } from './request/types.js';
8
9
  export interface JSONWPCommandError extends Error {
9
10
  code?: string;
10
11
  statusCode?: string;
@@ -49,13 +50,10 @@ type WebDriverClassicEvents = {
49
50
  };
50
51
  bidiCommand: Omit<CommandData, 'id'>;
51
52
  bidiResult: CommandResponse;
52
- 'request.performance': {
53
- durationMillisecond: number;
54
- error: string;
55
- request: unknown;
56
- retryCount: number;
57
- success: boolean;
58
- };
53
+ 'request.performance': RequestPerformanceEvent;
54
+ 'request.retry': RequestRetryEvent;
55
+ 'request.start': RequestStartEvent;
56
+ 'request.end': RequestEndEvent;
59
57
  };
60
58
  export type BidiEventMap = {
61
59
  [Event in keyof Omit<WebDriverBidiCommands, 'sendCommand' | 'sendAsyncCommand'>]: BidiInterface[WebDriverBidiCommands[Event]['socket']['command']];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,YA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WAAW,UAAW,SAAQ,YAAY,EAAE,YAAY;IAE1D,SAAS,EAAE,MAAM,CAAA;IAEjB,YAAY,EAAE,WAAW,CAAC,YAAY,CAAA;IAEtC,qBAAqB,EAAE,YAAY,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAA;IAE7E,OAAO,EAAE,OAAO,CAAC,SAAS,CAAA;CAC7B;AAED,MAAM,WAAW,MAAO,SAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB;CAAG;AAE5H,MAAM,WAAW,aAAc,SAAQ,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IACpF,SAAS,EAAE,MAAM,CAAA;IAEjB,YAAY,CAAC,EAAE,WAAW,CAAC,YAAY,CAAA;IAEvC,qBAAqB,CAAC,EAAE,YAAY,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAA;CACjF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webdriver",
3
- "version": "9.5.1",
3
+ "version": "9.5.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",
@@ -47,5 +47,5 @@
47
47
  "undici": "^6.20.1",
48
48
  "ws": "^8.8.0"
49
49
  },
50
- "gitHead": "83c76c40421092f0ce168270b5738e2826c5d0c7"
50
+ "gitHead": "b4e5733841d26e9b3e29cac5630f9bb67e33e00e"
51
51
  }
@@ -1,26 +0,0 @@
1
- import { EventEmitter } from 'node:events';
2
- import { URL } from 'node:url';
3
- import type { Options } from '@wdio/types';
4
- import type { WebDriverResponse } from './types.js';
5
- type RequestLibResponse = Options.RequestLibResponse;
6
- type RequestOptions = Omit<Options.WebDriver, 'capabilities'>;
7
- export declare const COMMANDS_WITHOUT_RETRY: string[];
8
- export default abstract class WebDriverRequest extends EventEmitter {
9
- #private;
10
- body?: Record<string, unknown>;
11
- method: string;
12
- endpoint: string;
13
- isHubCommand: boolean;
14
- requiresSessionId: boolean;
15
- constructor(method: string, endpoint: string, body?: Record<string, unknown>, isHubCommand?: boolean);
16
- makeRequest(options: RequestOptions, sessionId?: string): Promise<WebDriverResponse<unknown>>;
17
- protected _createOptions(options: RequestOptions, sessionId?: string, isBrowser?: boolean): Promise<{
18
- url: URL;
19
- requestOptions: RequestInit;
20
- }>;
21
- protected _libRequest(_url: URL, _options: RequestInit): Promise<RequestLibResponse>;
22
- protected _libPerformanceNow(): number;
23
- private _request;
24
- }
25
- export {};
26
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAMnD,KAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACpD,KAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAO7D,eAAO,MAAM,sBAAsB,UAElC,CAAA;AAWD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ,YAAY;;IAG/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;gBAEb,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,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