This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webdriver = require('selenium-webdriver'); | |
var fs = require('fs'); | |
var driver = new webdriver.Builder().build(); | |
webdriver.WebDriver.prototype.saveScreenshot = function(filename) { | |
return driver.takeScreenshot().then(function(data) { | |
fs.writeFile(filename, data.replace(/^data:image\/png;base64,/,''), 'base64', function(err) { | |
if(err) throw err; | |
}); |