webdriverio 8.43.0 → 8.44.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":"isElementClickable.d.ts","sourceRoot":"","sources":["../../src/scripts/isElementClickable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,IAAI,EAAE,WAAW,WAiJ5D"}
1
+ {"version":3,"file":"isElementClickable.d.ts","sourceRoot":"","sources":["../../src/scripts/isElementClickable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,IAAI,EAAE,WAAW,WAwJ5D"}
@@ -105,18 +105,25 @@ export default function isElementClickable(elem) {
105
105
  function isFullyDisplayedInViewport(elem) {
106
106
  return isElementInViewport(elem) && !hasOverlaps(elem);
107
107
  }
108
+ function getViewportScrollPositions() {
109
+ return {
110
+ // Cross-browser compatibility
111
+ x: window.scrollX ?? window.pageXOffset,
112
+ y: window.scrollY ?? window.pageYOffset,
113
+ };
114
+ }
108
115
  // scroll the element to the center of the viewport when
109
116
  // it is not fully displayed in the viewport or is overlapped by another element
110
117
  // to check if it still overlapped/not in the viewport
111
118
  // afterwards we scroll back to the original position
112
119
  let _isFullyDisplayedInViewport = isFullyDisplayedInViewport(elem);
113
120
  if (!_isFullyDisplayedInViewport) {
114
- const { x: originalX, y: originalY } = elem.getBoundingClientRect();
121
+ const { x: originalX, y: originalY } = getViewportScrollPositions();
115
122
  elem.scrollIntoView(scrollIntoViewFullSupport ? { block: 'center', inline: 'center' } : false);
116
123
  _isFullyDisplayedInViewport = isFullyDisplayedInViewport(elem);
117
- const { x, y } = elem.getBoundingClientRect();
118
- if (x !== originalX || y !== originalY) {
119
- elem.scroll(scrollX, scrollY);
124
+ const { x: currentX, y: currentY } = getViewportScrollPositions();
125
+ if (currentX !== originalX || currentY !== originalY) {
126
+ window.scroll(originalX, originalY);
120
127
  }
121
128
  }
122
129
  return _isFullyDisplayedInViewport && isEnabled(elem);
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": "8.43.0",
4
+ "version": "8.44.0",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <mail@bromann.dev>",
7
7
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "@types/node": "^22.2.0",
72
72
  "@wdio/config": "8.43.0",
73
73
  "@wdio/logger": "8.38.0",
74
- "@wdio/protocols": "8.40.3",
74
+ "@wdio/protocols": "8.44.0",
75
75
  "@wdio/repl": "8.40.3",
76
76
  "@wdio/types": "8.41.0",
77
77
  "@wdio/utils": "8.41.0",
@@ -92,7 +92,7 @@
92
92
  "resq": "^1.9.1",
93
93
  "rgb2hex": "0.2.5",
94
94
  "serialize-error": "^11.0.1",
95
- "webdriver": "8.43.0"
95
+ "webdriver": "8.44.0"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "devtools": "^8.14.0"
@@ -102,5 +102,5 @@
102
102
  "optional": true
103
103
  }
104
104
  },
105
- "gitHead": "f3783f61e0c62001cda71231fb4d947951f6f10d"
105
+ "gitHead": "ab1799cd214c8b61d39b3f53bd7220ad1027ded3"
106
106
  }