Reputation: 979
I want to capture full-height screenshots from a Nightwatch test, using Browserstack - I can capture the visible screen, but not the entire document.
I've tried this:
browser.execute(function () {
// get document dimensions
}, [], function (result) {
// browser.resizeWindow(to value sent as result)
browser.saveScreenshot('filename.png');
});
but while the resulting image has the correct width, the height is limited to (I think) the resolution of the browser opened in Browserstack.
Is it possible to achieve this?
Upvotes: 5
Views: 2929
Reputation: 7871
I solved this by doing 2 things:
"yourPlatformName": { "desiredCapabilities": { "resolution": "1200x3000" //... } }
browser.execute(function () { // get document dimensions }, [], function (result) { // browser.resizeWindow(to value sent as result) browser.resizeWindow(1200, 3000); browser.saveScreenshot('filename.png'); });
For me the size 1200x3000 is enough to capture the entire document. Try to increase those values and tests to meet your needs.
Upvotes: 2
Reputation: 343
I believe this is a limitation of the browser itself. For example, when testing on Chrome 29+ via Selenium, you will only be able to capture the visible area of the webpage displayed.
Are you able to capture a full page screenshot when running the test on the same browser locally on your machine? If yes, then you need to check this with BrowserStack. If it works locally then it should work on BrowserStack.
Upvotes: 0