Skip to content

Instantly share code, notes, and snippets.

@thekarel
Created November 26, 2013 12:59
Show Gist options
  • Save thekarel/7657903 to your computer and use it in GitHub Desktop.
Save thekarel/7657903 to your computer and use it in GitHub Desktop.
function writeScreenshot(data, name) {
name = name || 'ss.png';
var screenshotPath = 'C:\\selenium_local_map\\';
fs.writeFileSync(screenshotPath + name, data, 'base64');
};
driver.takeScreenshot().then(function(data) {
writeScreenshot(data, 'out1.png');
});
@vivacenontroppo
Copy link

It's not working anymore:

Failed: ENOENT: no such file or directory, open './screenshots/out1.png'

And from the comment:
browser.saveScreenshot() - that's a method from webdriver.io, not present in Selenium webdriver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment