Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/wrappers/pages.js

Issue 29938555: Noissue - Upgrade to selenium-webdriver 4.0.0-alpha (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Nov. 6, 2018, 8:32 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« test/browsers/firefox.js ('K') | « test/browsers/firefox.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/wrappers/pages.js
===================================================================
--- a/test/wrappers/pages.js
+++ b/test/wrappers/pages.js
@@ -58,28 +58,28 @@
return element.takeScreenshot().then(
imageFromBase64,
// Chrome doesn't support taking screenshots of individual elements. So as
// a workaround, we scroll to the position of the element, take a screenshot
// of the viewport and crop it to the size and position of our element.
// This is not guaranteed to work on other browsers (mostly because
// the behavior of Driver.takeScreenshot() may vary across browsers).
- () => element.getLocation().then(loc =>
+ () => element.getRect().then(loc =>
element.getDriver().executeScript(`
window.scrollTo(${loc.x}, ${loc.y});
return [window.scrollX, window.scrollY];
`).then(result =>
{
let x = loc.x - result[0];
let y = loc.y - result[1];
return Promise.all([
element.getDriver().takeScreenshot().then(imageFromBase64),
- element.getSize()
+ element.getRect()
Sebastian Noack 2018/11/06 09:02:33 You might want to use the loc variable (and maybe
hub 2018/11/07 17:13:37 Done.
]).then(([img, size]) =>
img.crop(x, y, size.width, size.height)
);
})
)
).then(img => img.bitmap);
}
« test/browsers/firefox.js ('K') | « test/browsers/firefox.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld