-
-
Save anonymous/52bafbda707e1d2199d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create() | |
casper.userAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'); | |
var userNames = ['username1','username2','username3','username4']; | |
var passWords = ['password1','password2','password3','password4']; | |
var url = 'http://somesite.com'; | |
function login(username, password) { | |
casper.then(function () { | |
this.sendKeys('#log', username); | |
this.sendKeys('#pwd', password); | |
this.click('#wpmem_login > form > fieldset > div.button_div > input.buttons'); | |
console.log("Log In button has been clicked!") | |
}); | |
casper.wait(5000, function () { | |
this.echo(this.getTitle()); | |
this.echo(this.fetchText('#wp-admin-bar-my-account > a')); | |
casper.capture('pic_'+username+'.png'); | |
}); | |
}; | |
casper.start(); // empty page | |
casper.viewport(1024, 768); | |
userNames.forEach(function(username, index){ | |
casper.thenOpen(url); // open the start page | |
login(username, passWords[index]); // schedule the steps | |
}); | |
casper.run(); // begin the execution |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment