Last active
August 29, 2015 13:56
-
-
Save akshay-bhardwaj/8859857 to your computer and use it in GitHub Desktop.
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
/* | |
* require, fs, wd, assert, colors | |
* saves screenshot in current folder as hello.png | |
*/ | |
var fs = require('fs'); | |
module.exports = function helloBrowserStack(browser, cb) { | |
browser.get("http://www.google.com", function() { | |
browser.title(function(err, title) { | |
browser.elementByName('q', function(err, el) { | |
el.sendKeys("BrowserStack", function() { | |
browser.elementByName("btnG", function(err,el) { | |
el.click(function() { | |
browser.takeScreenshot(function(err, res){ | |
data = new Buffer(res, 'base64'); | |
fdr = fs.openSync("hello.png", 'w'); | |
fs.writeSync(fdr,data,0,data.length); | |
browser.quit(); | |
}) | |
}) | |
}) | |
}) | |
}) | |
}) | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment