Created
November 7, 2016 05:11
-
-
Save kingspp/c1e0e1b66ffe59fc582f87f6c38823ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
@author: Prathyush SP | |
@created on: 7/11/16 | |
Prerequisites: | |
1. PhantomJS | |
2. CasperJS | |
Usage: casperjs dlink_router_config [Downstream Value] | |
*/ | |
var casper = require('casper').create({ | |
verbose: true, | |
logLevel: 'info', | |
pageSettings: { | |
loadImages: false, | |
loadPlugins: false, | |
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4' | |
} | |
}); | |
casper.start('http://192.168.0.1'); | |
casper.then(function() { | |
this.echo('First Page: ' + this.getTitle()); | |
this.fill('form[name="test"]', { | |
username: '[Router Username]', | |
password: '[Router Passoword]' | |
}, true); | |
}); | |
casper.then(function(){ | |
this.open('http://192.168.0.1/ipqostc_gen_ap.htm').then(function() { | |
this.then(function() { | |
this.fill('form[name="qostc"]', { | |
downtotal: ''+casper.cli.get(0)+'' | |
}, false); | |
this.echo(this.getFormValues('form[name="qostc"]').downtotal); | |
this.click('input[type="submit"][name="applyItflimit"]'); | |
}); | |
}); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment