I am using Browserstack's automate API with selenium-webdriver's node package to programatically take screenshots on different browsers and device
The desktop screenshots work fine - we screenshot, scroll, take another screenshot, until the end of the screen is reached. Then some code stitches the screenshots together.
On Android devices there is a problem, Browserstack takes screenshots that seem to include the space where the browser's bottom bar is, but it comes out as white space.
As per the Browserstack documentation, this is the method I am using to to the screenshot:
webdriver.WebDriver.prototype.saveScreenshot = (filename) => {
return driver.takeScreenshot().then((data) => {
fs.writeFile(
`${__dirname}/screenshots/${filename}`,
data.replace(/^data:image\/png;base64,/, ''),
'base64',
(err) => {
if (err) {
throw err;
}
},
);
});
};
I can successfully enter kiosk
mode with desktop Chrome by adding a --kiosk
argument to the chromeOptions
object, but it doesn't have any effect in Chrome on a mobile device.
I have also tried executing the script document.documentElement.requestFullScreen
through the driver, with no luck.
Is it possible to enter kiosk mode on android chrome programatically with selenium-webdriver?
Is there another way to reliably and programatically hide the url bar?