Skip to content

Instantly share code, notes, and snippets.

@shuynh
Last active August 29, 2015 13:58
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 shuynh/10176617 to your computer and use it in GitHub Desktop.
Save shuynh/10176617 to your computer and use it in GitHub Desktop.
var x = require('casper').selectXPath;
function randomEmail () {
var rand = "abcdefghiklmnopqrstuvwxyz1234567890";
return ([1,2,3,4,5,6,7,8]).map(function(a) {
return rand.charAt(Math.floor(Math.random() * rand.length)); }).join('') + '@yahoo.com';
}
casper.start('http://pv.webbyawards.com/users/sign_up', function () {
this.test.info('load webby signup');
});
casper.then(function() {
this.fill('#new_user', {
'user[email]': randomEmail(),
'user[password]': 'password',
'user[password_confirmation]': 'password'
}, false);
});
casper.then(function() {
this.click(x('//*[@id="new_user"]/div[7]/button'));
});
casper.thenOpen('http://pv.webbyawards.com/2014/web/general-website/media-streaming', function() {
this.test.info('vote for media streaming');
this.click(x('//*[@id="js-category-output"]/div/div/div[1]/div/a'));
});
casper.run(function() {
this.test.done();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment