I am attempting to automate logging in to a website. My below code works on my 2 Windows 10 machines but on my Win2K12r2 test environment, it errors with the following Error at each getElementById call.
Cannot find an overload for "getElementById" and the argument count: "1".
$username = "MY-USER"
$password = "MY-PASS"
$ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate("https://www.WEBSITE.com/login")
while($ie.ReadyState -ne 4) {start-sleep -m 100}
$ie.document.getElementById("userid").value= "$username"
$ie.document.getElementById("password").value = "$password"
$ie.document.getElementById("loginbutton").click()
start-sleep 20
$ie.navigate("https://www.WEBSITE.com/logout")
start-sleep 5
$ie.quit()
What am I missing on the Server OS?
- IE Enhanced Security Protection is disabled
- Compatibility Mode did nothing but cause more errors
- 'Run As Admin' changed nothing