Powershell website automating button click on login

27,688

Solution 1

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"}

Solution 2

Try

$ie.Document.getElementByID('dado_form_3').submit()
Share:
27,688
Admin
Author by

Admin

Updated on March 21, 2020

Comments

  • Admin
    Admin about 4 years

    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?

    $username='username' 
    $password='password'
    
    $ie = New-Object -ComObject 'internetExplorer.Application'
    $ie.Visible= $true
    $ie.Navigate("https://www.ksl.com/public/member/signin?login_forward=%2F")
    
    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"}
    $Link.click()