commit ca1a511cc4aefbcb9d9f9aea4bd4f3b6b7be0de8
parent 7c8302100901d7e5c5a22ee636ed4c40f559b4de
Author: Martin von Gagern <gagern@ma.tum.de>
Date: Tue, 3 Jan 2017 15:43:35 +0100
Load full-window page before adjusting browser window size
Experimenting with selenium-webdriver@3.0.1 and Firefox 50.1.0 I observed
screenshots having a height of merely 8 pixels. Presumably the margin or
padding of an otherwise empty document. So in order to get the actual size
of the document area, the screenshotter now loads a document which fills the
entire viewport.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/dockers/Screenshotter/screenshotter.js b/dockers/Screenshotter/screenshotter.js
@@ -239,6 +239,13 @@ function buildDriver() {
}
driver = builder.build();
driver.manage().timeouts().setScriptTimeout(3000).then(function() {
+ var html = '<!DOCTYPE html>' +
+ '<html><head><style type="text/css">html,body{' +
+ 'width:100%;height:100%;margin:0;padding:0;overflow:hidden;' +
+ '}</style></head><body><p>Test</p></body></html>';
+ html = "data:text/html," + encodeURIComponent(html);
+ return driver.get(html);
+ }).then(function() {
setSize(targetW, targetH);
});
}