I have the following PowerShell code that works fine on a machine with PowerShell 2.0 and IE 8, but does not work on a separate machine with IE 10.
$ie = new-object -com "InternetExplorer.Application"
$ie.visible=$true
$ie.Navigate("http://localhost/website/")
While ($ie.busy) {Sleep 2}
$doc = $ie.document
$autobutton = $doc.getElementById("IdName").Click()
The HTML code I'm attempting to access looks something like this:
<input type="radio" id="IdName" checked value="true" />
And here is the error I'm getting when running the PowerShell code above on the machine with IE 10:
"You cannot call a method on a null-valued expression."
Does IE 10 not support getElementById? Do I need modify my script to handle IE 10 differently so that the button gets clicked?
NOTE: the server with IE 10 also has PowerShell 3, and so I've tried using Invoke-WebRequest as well, but that doesn't seem to help either (get same error).
Thanks in advance!