Quantcast
Channel: Program & Design » JavaScript
Viewing all articles
Browse latest Browse all 5

Selenium, PhantomJS, Node, Screenshots and Sizzle

$
0
0
Without going into too much detail, I just wanted to post a snippet of how to get all these technologies playing nicely together: var webdriver = require('selenium-webdriver'); var fs = require('fs'); var driver = new webdriver.Builder() .withCapabilities(webdriver.Capabilities.phantomjs()) .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; }); })…

Read more Selenium, PhantomJS, Node, Screenshots and Sizzle


Viewing all articles
Browse latest Browse all 5

Trending Articles