Skip to content

Instantly share code, notes, and snippets.

@christian-bromann
Created September 2, 2013 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save christian-bromann/6416885 to your computer and use it in GitHub Desktop.
Save christian-bromann/6416885 to your computer and use it in GitHub Desktop.
run WebdriverJS with Mocha
var webdriverjs = require('webdriverjs'),
assert = require('assert');
describe('my webdriverjs tests', function(){
this.timeout(99999999);
var client = {};
before(function(){
client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} });
client.init();
});
it('Github test',function(done) {
client
.url('https://github.com/')
.getElementSize('.header-logo-wordmark', function(err, result) {
assert(err === null);
assert(result.height === 32);
assert(result.width === 89);
})
.getTitle(function(err, title) {
assert(err === null);
assert(title === 'GitHub · Build software better, together.');
})
.getElementCssProperty('css selector','a[href="/plans"]', 'color', function(err, result){
assert(err === null);
assert(result === 'rgba(65,131,196,1)');
})
.call(done);
});
after(function(done) {
client.end(done);
});
});
@marek-saji
Copy link

@sri85 Are you running it with mocha (and not node directly)?

mocha webdriverjs.with.mocha.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment