Taking screenshots in Selenium with Javascript
Using the below code we can even take screenshots with Javascript and the most important thing is this Javascript can be executed by any language using the Javascript executor
//Driver refers to Selenium Driver driver.takeScreenshot().then(function(data){ var base64Data = data.replace(/^data:image\/png;base64,/,"") fs.writeFile("out.png", base64Data, 'base64', function(err) { if(err) console.log(err); }); });