title: using powershell to click a link on a web page and then pass credentials
body: <p>I am trying to test our a web page we built that has a temp ssl cert, the issue is that when I goto the page I get the IE security warning that the ssl cert is invalid, with two links one to close the page, and the other to proceed to the page. I was able to use powershell to open IE and click the link on the ssl warning page, but now I need to populate the username and password input boxes and then click the login button.</p>
  
  <pre><code>$url = "res://ieframe.dll/invalidcert.htm?SSLError=50331648#https://10.2.2.1:8050/showme.do"
  $ie = New-Object -comobject InternetExplorer.Application 
  $ie.visible = $true 
  $ie.silent = $true 
  $ie.Navigate( $url )
  while( $ie.busy){Start-Sleep 1} 
  $secLink = $ie.Document.getElementsByTagName('A') | Where-Object {$_.innerText -   eq 'Continue to this website (not recommended).'} 
  $secLink.click() 
  $ie.Document.getElementsByType("input") | where { $.Name -eq "j_username" }.value = "user"
  $ie.Document.getElementsByName("input") | where { $.Name -eq "j_password" }.value = "password"
  $loginBtn = $ie.Document.getElementsById('input') | Where-Object {$_.Type -eq 'button' -and $_.Value -eq 'LoginButton'} 
  $loginBtn.click() 
  </code></pre>
  
  <p>So right now the page opens but the input fields are not populated or the button clicked, Do I need some kind of loop or while statement?</p>
  
  <p>thanks</p>