I am trying to automate the IE link where I am logging into the webpage and selecting some dropdown option on that. I am able to login to the link but not able to select the option from dropdown.
while ($ie.Busy -eq $true -or $ie.Document -eq $null ){Start-Sleep -seconds 1;}
$dropDown = $ie.Document.getElementById("state-area").contentDocument.getElementById("state-status")[1].selected = $true
Write-Host("Trying to select the dropdown")
$dropDown = $ie.Document.getElementById("state-area").contentDocument.getElementById("state-status").FireEvent("Ready")
Output:
You cannot call a method on a null-valued expression. At C:\Documents\TestScript4.ps1:51 char:13 + $dropDown = $ie.Document.getElementById("state-area").contentDocument.getElement ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
Trying to select the dropdown
You cannot call a method on a null-valued expression. At C:\Documents\TestScript4.ps1:59 char:1 + $dropDown = $ie.Document.getElementById("state-area").contentDocument.getElement ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull