IE automation with javascript form image

Welcome Forums General PowerShell Q&A IE automation with javascript form image

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #5281

    Points: 0
    Rank: Member

    by AA2012 at 2012-11-15 08:15:48

    Hi Everyone,

    This is both my first post on as well as first time using PowerShell. I'm currently trying to figure out how to automate a web login process and have hit a roadblock. I have searched the form the closest related post
    ''p2303 Its similar issue but slightly different as the submit button for the form is a image.

    I am currently trying to automate a login via IE.
    Here is a link to the webpage:

    I can fill in the username and password fields with the following logic:

    [code2=powershell]Import-Module C:\Users\A\Desktop\WASP\WASP.dll
    $username = 'username'
    $password = 'password'
    $IEProcess = Select-Window -Title "FIA Electronic Give-Up System Login*"

    $ie = new-object -com InternetExplorer.Application
    do {sleep 1} until (-not ($ie.Busy))
    $ie.visible = $true

    $usernameField = $doc.getElementById('username')
    $usernameField.value = $username
    $passwordField = $doc.getElementById('password')
    $passwordField.value = $password

    $IEProcess | Send-Keys "{Enter}"[/code2]

    Login button is stored as a image and doesn't have element id or tag name I can use to identify the button. So I tried to use the Select-Title and then Send Keys approach but nothing happens. I suspect I need to tweak the Select Window but not sure. Has anyone encountered a similar issue? If so, any suggestions would be appreciated. I'm just spinning my wheels at this point 🙂

    by coderaven at 2012-11-16 07:58:54

    I have not looked at the page but I have done this a few times and I think you want to look for the submit function of the form that contains the username and password fields. The image button is just calling that function.

    by AA2012 at 2012-11-16 15:02:46

    You were correct. This ended up being what worked for me, $doc.getElementById('loginForm').submit().
    Thanks for your help.

The topic ‘IE automation with javascript form image’ is closed to new replies.