I'm new to Powershell, and I've been struggling with this issue for longer than I care to admit. I am trying to automate the filling out of an intranet webform, and I thought this would be very simple. I've already got the login component worked out, but I am having trouble with completing the "Last Name" text box on the form.
$url = "www.myintranetsite.com"
$lastname="Smith"
$firstname="John"
$ie = New-Object -com internetexplorer.application;
$ie.visible = $true;
$ie.navigate($url);
while ($ie.Busy -eq $true)
{
Start-Sleep -Milliseconds 1000;
}
$ie.Document.getElementById("ERM_SEARCH_WRK_ERM_LAST_NAME_LBL").value =
$lastname
The error flagging is that I cannot call a method on a null-valued expression. The offender is the "ERM_SEARCH_WRK_ERM_LAST_NAME_LBL"
Any suggestions as to why $lastname would be returning as a null value?
![1]: https://i.stack.imgur.com/Jf8Ht.jpg ![2]: https://i.stack.imgur.com/pE71n.jpg