Jump to content

Auto sign in to web site. Can't get form to populate


Recommended Posts

#include <IE.au3>
HotKeySet("{ESC}", "_Exit")
HotKeySet('{NumPad1}', '_Run')

While 1
    Sleep(30)
WEnd

Func _Run()
    $URL = "http://peoplestring.com"
    $ObjIE = ObjCreate("InternetExplorer.Application")
    ;Wait until Forwarding Website loads
    With $ObjIE
        .Visible = True
        .Navigate($URL)
        Do
            Sleep(50)
        Until .ReadyState = 4
    EndWith
    ;Set Form Objects on Website

    With $ObjIE.document.forms(0)
        .user.value = ""
        .pass.value = ""
        .submit
    EndWith

EndFunc   ;==>_Run

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Hey, can't find the form name. Website is in code

Link to comment
Share on other sites

Use a DOM inspector, like DebugBar, to see if the form is inside frame or within another form. Your .forms(0) returns only the first form from the root of the document. Are you sure it's the first form?

:idea:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

The form is within an iFrame.

#include <IE.au3>

$sURL = "http://peoplestring.com/"
$sUsername = "username"
$sPassword = "password"

_IEErrorHandlerRegister()

$oIE = _IECreate($sURL, 1)
$oFrame = _IEFrameGetCollection($oIE, 0)
$oForm = _IEFormGetCollection($oFrame, 0)
$oUsername = _IEFormElementGetObjByName($oForm, "user")
$oPassword = _IEFormElementGetObjByName($oForm, "pass")
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...