Skip to content

Instantly share code, notes, and snippets.

@albburtsev
Created January 28, 2013 19:20
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 albburtsev/4658234 to your computer and use it in GitHub Desktop.
Save albburtsev/4658234 to your computer and use it in GitHub Desktop.
Casperjs test for URL with auth basic
var casper = require("casper").create();
var argDomain = casper.cli.get("domain"),
argLogin = casper.cli.get("login"),
argPassword = casper.cli.get("password");
if ( !argDomain ) {
casper.echo('USAGE: casperjs login.js --domain=DOMAIN --login=AUTH_LOGIN --password=AUTH_PASSWORD');
casper.exit();
}
if ( argLogin && argPassword )
casper = require("casper").create({
pageSettings: {
userName: argLogin,
password: argPassword
}
});
casper.start('http://' + argDomain + '/admin/', function() {
this.test.assertTitle('CMS Correct: Admin zone', 'Title correct!');
});
casper.run(function() {
this.test.done(1);
this.test.renderResults(true);
});
@sanjeevim
Copy link

Hi,

I need to get the Information like "url,username and password" from the user. How i can pass the arguments for the all three ?

Thanks,
Sanjeevi M

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