webdriverio 9.9.0 → 9.9.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.
@@ -3,7 +3,9 @@ type WaitState = 'none' | 'interactive' | 'networkIdle' | 'complete';
3
3
  *
4
4
  * The `url` command loads an URL in the browser. If a baseUrl is specified in the config,
5
5
  * it will be prepended to the url parameter using node's url.resolve() method. Calling
6
- * `browser.url('...')` with the same url as last time will trigger a page reload.
6
+ * `browser.url('...')` with the same url as last time will trigger a page reload. However,
7
+ * if the url contains a hash, the browser will not trigger a new navigation and the user
8
+ * has to [refresh](/docs/api/webdriver#refresh) the page to trigger one.
7
9
  *
8
10
  * The command returns an `WebdriverIO.Request` object that contains information about the
9
11
  * request and response data of the page load.
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/url.ts"],"names":[],"mappings":"AAKA,KAAK,SAAS,GAAG,MAAM,GAAG,aAAa,GAAG,aAAa,GAAG,UAAU,CAAA;AAKpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGG;AACH,wBAAsB,GAAG,CACrB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAAsB,GAChC,OAAO,CAAC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,CA0GrC;AAED,UAAU,iBAAiB;IACvB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE;QACH,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACf,CAAA;IACD;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAA;CAC/B"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/url.ts"],"names":[],"mappings":"AAKA,KAAK,SAAS,GAAG,MAAM,GAAG,aAAa,GAAG,aAAa,GAAG,UAAU,CAAA;AAKpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AACH,wBAAsB,GAAG,CACrB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAAsB,GAChC,OAAO,CAAC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,CA6HrC;AAED,UAAU,iBAAiB;IACvB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE;QACH,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACf,CAAA;IACD;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAA;CAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"isDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isDisplayed.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AAEH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,aAAa,GAAE,iBAAkC,oBAiEpD;AASD,UAAU,iBAAiB;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC/B"}
1
+ {"version":3,"file":"isDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isDisplayed.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AAEH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,aAAa,GAAE,iBAAkC,oBAgEpD;AASD,UAAU,iBAAiB;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"waitForExist.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForExist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAqG,EACxG,GAAE,cAAmB,iBAMzB"}
1
+ {"version":3,"file":"waitForExist.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForExist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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ourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,KAAK,cAAc,MAAM,WAAW,CAAA;AAGhD,OAAO,wBAAwB,MAAM,+BAA+B,CAAA;AAOpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,cAAc,YAAY,CAAA;AAC1B,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAc,CAAA;AAC9B,eAAO,MAAM,kBAAkB,iCAA2B,CAAA;AAE1D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM,WACP,YAAY,CAAC,iBAAiB,mBACrB,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,iBAAiB,KAAK,cAAc,CAAC,MAAM,KACnH,OAAO,CAAC,WAAW,CAAC,OAAO,CA4C7B,CAAA;AAED,eAAO,MAAM,MAAM,kBAAkC,aAAa,KAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CA8B/F,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,WACZ,YAAY,CAAC,gCAAgC,2BAC7B;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,KACxD,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAoExC,CAAA"}
package/build/index.js CHANGED
@@ -26,7 +26,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
26
26
  import logger27 from "@wdio/logger";
27
27
  import WebDriver, { DEFAULTS } from "webdriver";
28
28
  import { validateConfig } from "@wdio/config";
29
- import { enableFileLogging, wrapCommand as wrapCommand3 } from "@wdio/utils";
29
+ import { enableFileLogging, wrapCommand as wrapCommand3, isBidi } from "@wdio/utils";
30
30
 
31
31
  // src/multiremote.ts
32
32
  import zip from "lodash.zip";
@@ -4685,6 +4685,16 @@ var _NetworkManager = class _NetworkManager extends SessionManager {
4685
4685
  return __privateGet(this, _initialize3);
4686
4686
  }
4687
4687
  getRequestResponseData(navigationId) {
4688
+ if (!__privateGet(this, _requests).has(navigationId)) {
4689
+ const lastRequest = Array.from(__privateGet(this, _requests).values()).pop();
4690
+ if (!lastRequest) {
4691
+ return void 0;
4692
+ }
4693
+ const lastRequestUrl = new URL(lastRequest.url);
4694
+ if (lastRequestUrl.hash !== "") {
4695
+ return lastRequest;
4696
+ }
4697
+ }
4688
4698
  return __privateGet(this, _requests).get(navigationId);
4689
4699
  }
4690
4700
  /**
@@ -5517,6 +5527,15 @@ async function url(path, options = {}) {
5517
5527
  context,
5518
5528
  url: path,
5519
5529
  wait
5530
+ }).catch((err) => {
5531
+ if (
5532
+ // Chrome error message
5533
+ err.message.includes("navigation canceled by concurrent navigation") || // Firefox error message
5534
+ err.message.includes("failed with error: unknown error")
5535
+ ) {
5536
+ return this.navigateTo(validateUrl(path));
5537
+ }
5538
+ throw err;
5520
5539
  });
5521
5540
  if (mock2) {
5522
5541
  await mock2.restore();
@@ -5534,6 +5553,9 @@ async function url(path, options = {}) {
5534
5553
  if (resetPreloadScript) {
5535
5554
  await resetPreloadScript.remove();
5536
5555
  }
5556
+ if (!navigation) {
5557
+ return;
5558
+ }
5537
5559
  const request = await this.waitUntil(
5538
5560
  () => network.getRequestResponseData(navigation.navigation),
5539
5561
  /**
@@ -6917,8 +6939,7 @@ async function isDisplayed(commandParams = DEFAULT_PARAMS) {
6917
6939
  if (!await hasElementId(this)) {
6918
6940
  return false;
6919
6941
  }
6920
- const isNativeApplication = !browser2.capabilities.browserName;
6921
- if (browser2.isMobile && isNativeApplication) {
6942
+ if (browser2.isMobile && browser2.isNativeContext) {
6922
6943
  if (commandParams == null ? void 0 : commandParams.withinViewport) {
6923
6944
  throw new Error(
6924
6945
  "Cannot determine element visibility within viewport for native mobile apps as it is not feasible to determine full vertical and horizontal application bounds. In most cases a basic visibility check should suffice."
@@ -7783,16 +7804,21 @@ async function waitForEnabled({
7783
7804
  }
7784
7805
 
7785
7806
  // src/commands/element/waitForExist.ts
7786
- function waitForExist({
7807
+ async function waitForExist({
7787
7808
  timeout = this.options.waitforTimeout,
7788
7809
  interval = this.options.waitforInterval,
7789
7810
  reverse = false,
7790
7811
  timeoutMsg = 'element ("'.concat(this.selector, '") still ').concat(reverse ? "" : "not ", "existing after ").concat(timeout, "ms")
7791
7812
  } = {}) {
7792
- return this.waitUntil(
7813
+ const isExisting2 = await this.waitUntil(
7793
7814
  async () => reverse !== await this.isExisting(),
7794
7815
  { timeout, interval, timeoutMsg }
7795
7816
  );
7817
+ if (!reverse && isExisting2 && typeof this.selector === "string") {
7818
+ this.elementId = await this.parent.$(this.selector).elementId;
7819
+ delete this.error;
7820
+ }
7821
+ return isExisting2;
7796
7822
  }
7797
7823
 
7798
7824
  // src/commands/element/waitForStable.ts
@@ -8920,6 +8946,9 @@ var attach = async function(attachOptions) {
8920
8946
  wrapCommand3
8921
8947
  );
8922
8948
  driver.addLocatorStrategy = addLocatorStrategyHandler(driver);
8949
+ if (isBidi(driver.capabilities) && "_bidiHandler" in driver) {
8950
+ await driver["_bidiHandler"].waitForConnected();
8951
+ }
8923
8952
  await registerSessionManager(driver);
8924
8953
  return driver;
8925
8954
  };
package/build/node.js CHANGED
@@ -496,7 +496,7 @@ async function saveElementScreenshot(filepath) {
496
496
  import logger28 from "@wdio/logger";
497
497
  import WebDriver, { DEFAULTS } from "webdriver";
498
498
  import { validateConfig } from "@wdio/config";
499
- import { enableFileLogging, wrapCommand as wrapCommand3 } from "@wdio/utils";
499
+ import { enableFileLogging, wrapCommand as wrapCommand3, isBidi } from "@wdio/utils";
500
500
 
501
501
  // src/multiremote.ts
502
502
  import zip from "lodash.zip";
@@ -4836,6 +4836,16 @@ var NetworkManager = class _NetworkManager extends SessionManager {
4836
4836
  response.children?.push(request);
4837
4837
  }
4838
4838
  getRequestResponseData(navigationId) {
4839
+ if (!this.#requests.has(navigationId)) {
4840
+ const lastRequest = Array.from(this.#requests.values()).pop();
4841
+ if (!lastRequest) {
4842
+ return void 0;
4843
+ }
4844
+ const lastRequestUrl = new URL(lastRequest.url);
4845
+ if (lastRequestUrl.hash !== "") {
4846
+ return lastRequest;
4847
+ }
4848
+ }
4839
4849
  return this.#requests.get(navigationId);
4840
4850
  }
4841
4851
  /**
@@ -5538,6 +5548,15 @@ async function url(path4, options = {}) {
5538
5548
  context,
5539
5549
  url: path4,
5540
5550
  wait
5551
+ }).catch((err) => {
5552
+ if (
5553
+ // Chrome error message
5554
+ err.message.includes("navigation canceled by concurrent navigation") || // Firefox error message
5555
+ err.message.includes("failed with error: unknown error")
5556
+ ) {
5557
+ return this.navigateTo(validateUrl(path4));
5558
+ }
5559
+ throw err;
5541
5560
  });
5542
5561
  if (mock2) {
5543
5562
  await mock2.restore();
@@ -5555,6 +5574,9 @@ async function url(path4, options = {}) {
5555
5574
  if (resetPreloadScript) {
5556
5575
  await resetPreloadScript.remove();
5557
5576
  }
5577
+ if (!navigation) {
5578
+ return;
5579
+ }
5558
5580
  const request = await this.waitUntil(
5559
5581
  () => network.getRequestResponseData(navigation.navigation),
5560
5582
  /**
@@ -6642,8 +6664,7 @@ async function isDisplayed(commandParams = DEFAULT_PARAMS) {
6642
6664
  if (!await hasElementId(this)) {
6643
6665
  return false;
6644
6666
  }
6645
- const isNativeApplication = !browser2.capabilities.browserName;
6646
- if (browser2.isMobile && isNativeApplication) {
6667
+ if (browser2.isMobile && browser2.isNativeContext) {
6647
6668
  if (commandParams?.withinViewport) {
6648
6669
  throw new Error(
6649
6670
  "Cannot determine element visibility within viewport for native mobile apps as it is not feasible to determine full vertical and horizontal application bounds. In most cases a basic visibility check should suffice."
@@ -7482,16 +7503,21 @@ async function waitForEnabled({
7482
7503
  }
7483
7504
 
7484
7505
  // src/commands/element/waitForExist.ts
7485
- function waitForExist({
7506
+ async function waitForExist({
7486
7507
  timeout = this.options.waitforTimeout,
7487
7508
  interval = this.options.waitforInterval,
7488
7509
  reverse = false,
7489
7510
  timeoutMsg = `element ("${this.selector}") still ${reverse ? "" : "not "}existing after ${timeout}ms`
7490
7511
  } = {}) {
7491
- return this.waitUntil(
7512
+ const isExisting2 = await this.waitUntil(
7492
7513
  async () => reverse !== await this.isExisting(),
7493
7514
  { timeout, interval, timeoutMsg }
7494
7515
  );
7516
+ if (!reverse && isExisting2 && typeof this.selector === "string") {
7517
+ this.elementId = await this.parent.$(this.selector).elementId;
7518
+ delete this.error;
7519
+ }
7520
+ return isExisting2;
7495
7521
  }
7496
7522
 
7497
7523
  // src/commands/element/waitForStable.ts
@@ -8601,6 +8627,9 @@ var attach = async function(attachOptions) {
8601
8627
  wrapCommand3
8602
8628
  );
8603
8629
  driver.addLocatorStrategy = addLocatorStrategyHandler(driver);
8630
+ if (isBidi(driver.capabilities) && "_bidiHandler" in driver) {
8631
+ await driver["_bidiHandler"].waitForConnected();
8632
+ }
8604
8633
  await registerSessionManager(driver);
8605
8634
  return driver;
8606
8635
  };
@@ -1 +1 @@
1
- {"version":3,"file":"networkManager.d.ts","sourceRoot":"","sources":["../../src/session/networkManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,kBAE7D;AAMD;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,cAAc;;gBAMlC,OAAO,EAAE,WAAW,CAAC,OAAO;IA6BxC,eAAe,IAAI,IAAI;IAQjB,UAAU;IA+JhB,sBAAsB,CAAC,YAAY,EAAE,MAAM;IAI3C;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE;CAqBlE"}
1
+ {"version":3,"file":"networkManager.d.ts","sourceRoot":"","sources":["../../src/session/networkManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,kBAE7D;AAMD;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,cAAc;;gBAMlC,OAAO,EAAE,WAAW,CAAC,OAAO;IA6BxC,eAAe,IAAI,IAAI;IAQjB,UAAU;IA+JhB,sBAAsB,CAAC,YAAY,EAAE,MAAM;IAkB3C;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE;CAqBlE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webdriverio",
3
3
  "description": "Next-gen browser and mobile automation test framework for Node.js",
4
- "version": "9.9.0",
4
+ "version": "9.9.2",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <mail@bromann.dev>",
7
7
  "license": "MIT",
@@ -99,7 +99,7 @@
99
99
  "rgb2hex": "0.2.5",
100
100
  "serialize-error": "^11.0.3",
101
101
  "urlpattern-polyfill": "^10.0.0",
102
- "webdriver": "9.9.0"
102
+ "webdriver": "9.9.1"
103
103
  },
104
104
  "peerDependencies": {
105
105
  "puppeteer-core": "^22.3.0"
@@ -109,5 +109,5 @@
109
109
  "optional": true
110
110
  }
111
111
  },
112
- "gitHead": "620e092391d7bcc71cd7cd55ad146ad72e522da9"
112
+ "gitHead": "05d66ef279e7d2c8abf97bb9029016f0eafcfafd"
113
113
  }