Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var webdriver = require('selenium-webdriver');
- // Input capabilities
- var capabilities = {
- 'browserName' : 'Chrome',
- 'browser_version' : '43.0',
- 'os' : 'Windows',
- 'os_version' : '7',
- 'resolution' : '1024x768',
- 'browserstack.user' : '<username>',
- 'browserstack.key' : '<access_key>',
- 'browserstack.local' : true,
- 'browserstack.debug' : true,
- 'build' : 'BS Test case',
- 'name' : 'Test With Local',
- 'project' : 'BS Test case'
- }
- var driver = new webdriver.Builder().
- usingServer('http://hub.browserstack.com/wd/hub').
- withCapabilities(capabilities).
- build();
- driver.get('<Your_URL>');
- var WAIT_TIME = 5000;
- return driver.sleep(WAIT_TIME).then(function() {
- var fs = require('fs');
- 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;
- });
- })
- };
- driver.saveScreenshot('scr_with_local.png');
- driver.quit();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement