Skip to content

Instantly share code, notes, and snippets.

@lazytesting
Last active November 23, 2016 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazytesting/3e27896dbf146f8faffd70a90f26e936 to your computer and use it in GitHub Desktop.
Save lazytesting/3e27896dbf146f8faffd70a90f26e936 to your computer and use it in GitHub Desktop.
Quick webdriver script

Install and run webdriver server

npm install selenium-standalone@latest -g selenium-standalone install selenium-standalone start

{
"name": "wd",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"webdriverio": "^4.2.16"
}
}
var webdriverio = require('webdriverio');
var options = { desiredCapabilities: { browserName: 'chrome' } };
var client = webdriverio.remote(options);
client
.init()
.url('http://www.google.com')
.getTitle().then(function(title) {
console.log('Title is: ' + title);
})
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment