I have a flaky wifi access point that I'd like to automate to reboot every night.
It has a typical web interface for administration, and I want to use cscript / wscript to automate IE 11 to reboot the access point.
I'm aware that IE is discontinued, and webdriver / selenium are better. But I'd just like to stick to the built-in windows tools (ergo, internet explorer).
The problem: for some reason, my script can locate and fill in the password field successfully, but there's no response when I click() on the login button. The (JS) script looks like so:
var ie = WScript.CreateObject("InternetExplorer.Application", "ieEvent_");
ie.visible = true;
ie.navigate("/");
function ieEvent_DocumentComplete(pDisp, URL) {
WScript.echo(URL);
if (URL.substring(0, 10) !== "http://192") return;
var txt_pass = ie.document.getElementById("admin_Password");
var btn_login = ie.document.getElementById("logIn_btn");
if ((txt_pass !== null) && (btn_login !== null)) { // #1: login page
WScript.echo("#1 login page");
txt_pass.value = "password";
btn_login.click(); // doesn't work?
} else {
...
}
}
Yet, the exact same code works in the IE dev console:
btn_login = document.getElementById("logIn_btn");
btn_login.click();
Is there any reason click() might be blocked when executed via COM, but not in the dev console?
For the record, the device is a D-Link M15. For those familiar with the device, I know it has a built-in scheduled reboot function. Unfortunately, that functionality is disabled when the device is set to "Extender Mode".