title: Using powershell to fill a web text box and press a button
body: <p>I am trying to use powershell to automate opening IE and placing a value inside a text box and pressing a button.</p>
  <pre><code>Add-Type -AssemblyName Microsoft.VisualBasic 
  cls
  $orderID = &quot;text box entry&quot; 
  $smoURL = &quot;URL&quot;
  $iterator = 1;
  
  Write-Host (&quot;ID = $orderID&quot;)
  
  $orderIDTextBox = &quot;txtOrderID&quot;
  $searchButton = &quot;btnSearch&quot;
  
  $IE = New-Object -ComObject InternetExplorer.Application
  $ie.visible = $true
  $ie.navigate(&quot;$smoURL&quot;)
  While ($IE.Busy -eq $true) {Start-Sleep -Milliseconds 2000} 
  
      Start-Sleep -Seconds 3
  
  $ie.Document.getElementById(&quot;$orderIDTextBox&quot;).value = &quot;$orderID&quot;
  $Submit = $ie.Document.getElementsByTagName(&quot;$btnSearch&quot;) 
  $Submit.click()
  </code></pre>
  <p>I've got the site to open but when I try populate the text field I get this error message:</p>
  <p><a href="https://i.stack.imgur.com/v2W7z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v2W7z.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/y60TS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y60TS.png" alt="This is the inspect element on the webpage." /></a></p>
  <p>This is the inspect element on the webpage.</p>