Jump to content

A particular website......


 Share

Recommended Posts

Dear Experts (I know how to get on you good side!),

I am completely new to AutoIT, I found a recommendation for it from Experts-Exchange. And it appears to be just what I need.

Basically, we want to automate the extraction of consignment data from the Fedex website. Only downloaded it yesterday afternoon and it's so easy, I can already automate the process using key sends and mouse clicks, but it requires certain conditions for the mouse click to move to the right place and work i.e. Internet Explorer maximised.

I've looked at other examples and I can see that this is probably not the ideal way to do it even though it does work just fine (if the IE window is maximised). Other examples are using automation and OLE and actually directly filling fields and perfoming form submits.

But I cannot get my head around the AutoIT automation stuff for IE.

I can get it to load a webpage by following examples:

include <IE.au3>

#include <IE.au3>

$sURL = "http://www.fedexuk.net/accounts/MainLogin.aspx?ReturnUrl=%2faccounts%2fTrackingSearch.aspx"

$oIE = _IECreate($sURL)

$oForm = _IEFormGetCollection($oIE, 1)

$oUSER = _IEFormElementGetObjByName($oForm, "ctl00$cphPage$txtUserName")

$oPassword = _IEFormElementGetObjByName($oForm, "ctl00$cphPage$txtPassword")

_IEFormElementSetValue($oUSER, "abc")

_IEFormElementSetValue($oPassword, "123")

_IEFormSubmit($oForm)

(obviously with user and password changed!)

It fills the form correctly and obviously attempts to logon but it doesn't. But I can logon manually by then just entering the password again and clicking the button? Any ideas?

Many thanks,

(newbie) Trevor

Link to comment
Share on other sites

Many forms now don't work well with the _IEFormSubmit() but there are other ways to do this. Just read through the _IE* functions carefully and see if you can find one :). If not maybe the resident IE expert (Dale) will see this thread and help you out.

Link to comment
Share on other sites

Hey Marbles, welcome to the forum.

As dbzfanatic was saying, you can't always use IEFormSubmit. I tried using IEAction instead and that seems to work. This is the new code...

#include <IE.au3>

$sURL = "http://www.fedexuk.net/accounts/MainLogin.aspx?ReturnUrl=%2faccounts%2fTrackingSearch.aspx"
$oIE = _IECreate($sURL)
$oForm = _IEFormGetCollection($oIE, 1)

$oUSER = _IEFormElementGetObjByName($oForm, "ctl00$cphPage$txtUserName")
$oPassword = _IEFormElementGetObjByName($oForm, "ctl00$cphPage$txtPassword")
$oSubmit = _IEGetObjByName ($oIE, "ctl00$cphPage$Button1")


_IEFormElementSetValue($oUSER, "abc")
_IEFormElementSetValue($oPassword, "123")
Sleep(3000)
;_IEFormSubmit($oForm)
_IEAction ($oSubmit, "click")

I threw the sleep in there so you can see it fill in the forms and attempt to login, but it will work without it. Have you checked out the tools/links DaleHohm recommends? Debugbar makes working with IE automation much easier.

Good luck!

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
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...