1

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
Shawn
  • 561
  • 1
  • 5
  • 12
  • Might be [related to https](http://stackoverflow.com/questions/24660691/cannot-find-an-overload-for-getelementbyid-and-the-argument-count-1), so try adding the address as a trusted site. – vonPryz May 24 '16 at 07:39

0 Answers0