Hello,
I have a PowerShell script that I use to automate an Internet Explorer window. Basically the code does this:
$ie = New-Object -com InternetExplorer.Application
$ie.navigate('https://www.somewebsite.aspx')
Start-Sleep -Seconds 60 # My code checks for Busy and ReadyState, but this will suffice
$someField = $ie.document.getElementById('theNameOfTheField')
if ($someField -eq $null)
{
Write-Output 'Some field was not found'
}
I'm passing the name of the field and not the ID. In Windows 7 this works just fine and the field is found. In Window 10, the field is not found.
According to the online documentation (https://msdn.microsoft.com/en-us/library/ms536437%28v=vs.85%29.aspx), the getElementById field will match on the ID or NAME attribute.
In Windows 10 this is not happening. If I use the ID, the element is found with no problems.
The other problem is that Windows 10 doesn't return a null when it fails (as the documentation states it should). It returns an object of the type System.DBNull.
Thanks,
Steve :)