Gene
Gene

Reputation: 1

How to have vbscript press submit/enter after input of username and pw

I'm trying to create a simple vbs file to have multiple websites auto login with just one click. Problem is I cant get the website to automatically press enter/submit after it puts in the username and pw.

Call Main

Function Main
    Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
    IE.Visible = True
    Wait IE
    With IE.Document
        .getElementByID("username").value = "username"
        .getElementByID("password").value = "password" 
        .getElementsByClassName("login_button")(0).Submit
    End With
End Function

Sub Wait(IE)
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy
End Sub

Any help would be greatly appreciated. :)

Upvotes: 0

Views: 861

Answers (1)

Pupa Rebbe
Pupa Rebbe

Reputation: 528

try

.getElementsByClassName("login_button")(0).Click

or

.forms(0).submit

Upvotes: 1

Related Questions