webdriverio
Advanced tools
Comparing version
@@ -108,2 +108,9 @@ /** | ||
} | ||
function getViewportScrollPositions() { | ||
return { | ||
// Cross-browser compatibility | ||
x: window.scrollX ?? window.pageXOffset, | ||
y: window.scrollY ?? window.pageYOffset, | ||
}; | ||
} | ||
// scroll the element to the center of the viewport when | ||
@@ -115,8 +122,8 @@ // it is not fully displayed in the viewport or is overlapped by another element | ||
if (!_isFullyDisplayedInViewport) { | ||
const { x: originalX, y: originalY } = elem.getBoundingClientRect(); | ||
const { x: originalX, y: originalY } = getViewportScrollPositions(); | ||
elem.scrollIntoView(scrollIntoViewFullSupport ? { block: 'center', inline: 'center' } : false); | ||
_isFullyDisplayedInViewport = isFullyDisplayedInViewport(elem); | ||
const { x, y } = elem.getBoundingClientRect(); | ||
if (x !== originalX || y !== originalY) { | ||
elem.scroll(scrollX, scrollY); | ||
const { x: currentX, y: currentY } = getViewportScrollPositions(); | ||
if (currentX !== originalX || currentY !== originalY) { | ||
window.scroll(originalX, originalY); | ||
} | ||
@@ -123,0 +130,0 @@ } |
{ | ||
"name": "webdriverio", | ||
"description": "Next-gen browser and mobile automation test framework for Node.js", | ||
"version": "8.43.0", | ||
"version": "8.44.0", | ||
"homepage": "https://webdriver.io", | ||
@@ -74,3 +74,3 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"@wdio/logger": "8.38.0", | ||
"@wdio/protocols": "8.40.3", | ||
"@wdio/protocols": "8.44.0", | ||
"@wdio/repl": "8.40.3", | ||
@@ -96,3 +96,3 @@ "@wdio/types": "8.41.0", | ||
"serialize-error": "^11.0.1", | ||
"webdriver": "8.43.0" | ||
"webdriver": "8.44.0" | ||
}, | ||
@@ -107,3 +107,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "f3783f61e0c62001cda71231fb4d947951f6f10d" | ||
"gitHead": "ab1799cd214c8b61d39b3f53bd7220ad1027ded3" | ||
} |
Sorry, the diff of this file is not supported yet
624319
0.04%13468
0.05%+ Added
- Removed
- Removed
Updated
Updated