Jump to content

Recommended Posts

CODE

$oIE = _IECreate("http://mail.yahoo.com",0,0)

$oform = _IEFormGetObjByName($oIE, "login_form")

$ologin = _IEFormElementGetObjByName($oform, "login")

$opassword = _IEFormElementGetObjByName($oform, "passwd")

_IEFormElementSetValue($ologin, $sUsername)

_IEFormElementSetValue($opassword, $sPassword)

_IEFormElementCheckboxSelect ($oForm, "keep me signed in")

Sleep(1000)

MsgBox(0,"","ready to submit")

If $i = 1 Then ShellExecute($killProcess)

_IEFormSubmit($oform)

I'm doing the above and it hangs at the _IEFormSubmit($oform).

Also how do I find the name of the specific elements like check boxes and buttons when there is more than one on a web page?

TIA, Dennis

Link to post
Share on other sites

Here you go:

#include <IE.au3>

$oIE = _IECreate("http://mail.yahoo.com",0,1)

$oform = _IEFormGetObjByName($oIE, "login_form")
$ologin = _IEFormElementGetObjByName($oform, "login")
$opassword = _IEFormElementGetObjByName($oform, "passwd")
$opersistent = _IEFormElementGetObjByName($oform, "persistent")

_IEFormElementSetValue($ologin, $sUsername)
_IEFormElementSetValue($opassword, $sPassword)

_IEFormElementCheckboxSelect ($oForm, "", $opersistent, 1, "byindex")

Sleep(1000)
MsgBox(0,"","ready to submit")
;If $i = 1 Then ShellExecute($killProcess);Don't know what this was supposed to do?

_IEFormSubmit($oform)

I got the element ID from the html source.

Several ways you can get it. Open it in frontpage or somekind of web page design app.

I just opened it with notepad and searched for the text "Keep me signed in" Once I found that I just looked for a checkbox just before or after it.

Here's the section of html code

<p id="sigcopys"><input type="checkbox" id="persistent" name=".persistent" value="y"CHECKED> <label for="persistent"> <span class="kmsibold">Keep me signed in</span><br><span class="subperstxt">for 2 weeks unless I sign out.</span> <em class="nwred"><a

You will not always find ID's, it's not required for simple form functions on a page. In which case you will have to use the name field.

But given the choice use the ID. The ID has to be unique the name does not.

Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...