Skip to content

Instantly share code, notes, and snippets.

@deanhume
Last active August 29, 2015 14:15
Show Gist options
  • Save deanhume/92c1a00edb5d379c27b4 to your computer and use it in GitHub Desktop.
Save deanhume/92c1a00edb5d379c27b4 to your computer and use it in GitHub Desktop.
Selenium running Node using Webdriver.io
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'firefox'
}
};
webdriverio
.remote(options)
.init()
.url('http://www.bbc.co.uk/') // navigate to the web page
.setValue('#orb-search-q', ['surfing'], function(){}) // find the element and enter the query
.submitForm('#orb-search-form') // submit the form
.title(function(err, res) {
console.log('Title was: ' + res.value); // Confirm the page title
})
.saveScreenshot('./snapshot.png') // Save the screenshot to disk
.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment