From ca1a511cc4aefbcb9d9f9aea4bd4f3b6b7be0de8 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Tue, 3 Jan 2017 15:43:35 +0100 Subject: [PATCH] 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. --- dockers/Screenshotter/screenshotter.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dockers/Screenshotter/screenshotter.js b/dockers/Screenshotter/screenshotter.js index e49a4b2..dc31cb5 100644 --- 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 = '' + + '

Test

'; + html = "data:text/html," + encodeURIComponent(html); + return driver.get(html); + }).then(function() { setSize(targetW, targetH); }); }