Created
February 12, 2016 11:14
-
-
Save tsjk/6ca9a32bc1c248ce44f8 to your computer and use it in GitHub Desktop.
Rebooting a NETGEAR Gateway CG3700EMR-1CMNDS using CasperJS. Usage: casperjs reboot--CG3700EMR-1CMNDS.js <routerIP> <adminLogin> <admiPassword>
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(); | |
var utils = require('utils'); | |
casper.start(); | |
casper.setHttpAuth(casper.cli.get(1), casper.cli.get(2)); | |
casper.thenOpen('http://' + casper.cli.get(0)).then(function() { | |
this.echo(this.getTitle() + ': Logged in.'); | |
}); | |
casper.then(function() { | |
this.wait(1000, function() { | |
this.echo(this.getTitle() + ': Issuing reboot.'); | |
}); | |
}); | |
casper.thenOpenAndEvaluate('http://' + casper.cli.get(0) + '/RouterStatus.htm', function() { | |
var f = document.forms[0]; | |
f.buttonSelect.value="2"; | |
f.submit(f); | |
}); | |
casper.then(function() { | |
this.echo(this.getTitle() + ': Reboot issued.'); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment