Skip to content

Instantly share code, notes, and snippets.

@collegeimprovements
Last active August 29, 2015 14:25
Show Gist options
  • Save collegeimprovements/ef3589791e8e793c6104 to your computer and use it in GitHub Desktop.
Save collegeimprovements/ef3589791e8e793c6104 to your computer and use it in GitHub Desktop.
gist to fill textboxes with casperjs
var casper = require('casper').create({logLevel: "debug"});
casper.start('https://alarmadmin.alarm.com/default.aspx', function() {
casper.echo(this.getTitle());
if(this.exists('#txtUsername'))
{casper.echo('\n\n#txtUsername found***>>>');}else{casper.echo('\n\n#txtUsername NOT found***>>>');}
if(this.exists('#txtPassword'))
{casper.echo('\n\n#txtPassword found***>>>');}else{casper.echo('\n\n#txtPassword NOT found***>>>');}
this.sendKeys('input[name=txtPassword]', 'Cybage1');
this.sendKeys('input[name=txtUsername]', 'cybagereg');
casper.capture('pre.png');
this.click('#butLogin');
casper.capture('aha.png');
casper.wait(8000,function(){
casper.echo(this.getCurrentUrl());});
});
casper.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment