webdriverio 8.43.0 → 8.44.1

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,WA4J5D"}
@@ -105,18 +105,29 @@ 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 !== null && window.scrollX !== void 0
112
+ ? window.scrollX
113
+ : window.pageXOffset,
114
+ y: window.scrollY !== null && window.scrollY !== void 0
115
+ ? window.scrollY
116
+ : window.pageYOffset,
117
+ };
118
+ }
108
119
  // scroll the element to the center of the viewport when
109
120
  // it is not fully displayed in the viewport or is overlapped by another element
110
121
  // to check if it still overlapped/not in the viewport
111
122
  // afterwards we scroll back to the original position
112
123
  let _isFullyDisplayedInViewport = isFullyDisplayedInViewport(elem);
113
124
  if (!_isFullyDisplayedInViewport) {
114
- const { x: originalX, y: originalY } = elem.getBoundingClientRect();
125
+ const { x: originalX, y: originalY } = getViewportScrollPositions();
115
126
  elem.scrollIntoView(scrollIntoViewFullSupport ? { block: 'center', inline: 'center' } : false);
116
127
  _isFullyDisplayedInViewport = isFullyDisplayedInViewport(elem);
117
- const { x, y } = elem.getBoundingClientRect();
118
- if (x !== originalX || y !== originalY) {
119
- elem.scroll(scrollX, scrollY);
128
+ const { x: currentX, y: currentY } = getViewportScrollPositions();
129
+ if (currentX !== originalX || currentY !== originalY) {
130
+ window.scroll(originalX, originalY);
120
131
  }
121
132
  }
122
133
  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.1",
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": "79211c731aee2e823d2c6db8b7790eba4048eae0"
106
106
  }