Skip to content

Instantly share code, notes, and snippets.

@ragulka
Last active August 29, 2015 13: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 ragulka/10458018 to your computer and use it in GitHub Desktop.
Save ragulka/10458018 to your computer and use it in GitHub Desktop.
Injecting and executing Javascript in Selenium tests using camme/webdriverjs
// This snippets shows how you can inject and execute Javascript in your Selenium tests using camme/debriverjs.
// This particular example uses jQuery to get the count of list-item elements on the page and returns it.
// In the callback you can then access the returned value as `result.value`
it('must have 4 list-item elements', function (done) {
client
.execute(function() {
return $('ul li').length;
}, [], function (err, result) {
result.value.must.eql(4);
})
.call(done);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment