user3482032 user3482032 - 1 year ago 182
PowerShell Question

Powershell website automating button click on login

So I'm new to powershell. I've built a few scripts for fun but got stuck on one that I don't seem to be able to figure out. I'm trying to automate the clicking of the "Continue" button but don't know what to do. I have tried everything I can think of. Any ideas?


$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true

while ($ie.Busy -eq $true){Start-Sleep -seconds 1;}

$usernamefield = $ie.Document.getElementByID('memberemail')
$usernamefield.value = $username

$passwordfield = $ie.Document.getElementByID('memberpassword')
$passwordfield.value = $password

$Link=$ie.Document.getElementsByTagName("input") | where-object {$_.type -eq "continue"}

Answer Source

The problem is that the object's Type is Image, not continue. The ClassName is continue. Try this line in that code and see if that works for you:

$Link=$ie.Document.getElementsByTagName("input") | where-object {$_.className -eq "continue"}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download