Hi,
I've built the following script that supposed to add text in the Google search box:
$url = "https://www.google.com/"
$search_input="something"
$ie = New-Object -com internetexplorer.application;
$ie.visible = $true;
$ie.navigate($url);
while ($ie.Busy -eq $true)
{
Start-Sleep -Milliseconds 1000;
}
$ie.Document.getElementById("lst-ib").value = $search_input
I'm getting the following errors:
PS C:\Users\user\Desktop> .\Serach_In_Google.ps1
You cannot call a method on a null-valued expression.
At C:\Users\user\Desktop\Serach_In_Google.ps1:10 char:28
+ $ie.Document.getElementById <<<< ("lst-ib").value = $search_input
+ CategoryInfo : InvalidOperation: (getElementById:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Thanks