Jump to content
Sign in to follow this  
falko

General questions "How to", esp. for IE

Recommended Posts

falko

Hi all,

im new here and with AutoIt and hope to get some hints how to solve my problem(s).

I have to fill some forms within a website using IE.

So first I included IE.au3 and code looks similar to that:.

#include <IE.au3>

ShellExecute ("iexplore.exe", "about:blank")

$oIE = _IEAttach ("about:blank", "url")

_IELoadWait ($oIE)

_IENavigate ($oIE, "https://...../Login.....")

_IELoadWait ($oIE)

send("myusername")

$o_form = _IEFormGetObjByName ($oIE, "LoginForm")

$name = _IEFormElementGetObjByName ($o_form, "LoginForm:userName")

$pw = _IEFormElementGetObjByName ($o_form, "LoginForm:userPassword")

$login = _IEFormElementGetObjByName ($o_form, "LoginForm:Login")

_IEAction ($pw, "focus")

send("Mypassword")

_IEAction ($login, "click")

That works fine.

On the next page the "continue button" has no name :-(

So I think I have to use something like

$contbut = _IEFormGetObj[5]

_IEAction ($contbut, "click")

Is there a command to list all objects in the lower Editor-window to "Sniff" the source code?

Where do I get a listing of all IE.au3-methods? With examples?

And, even worse, the next page doesn't work with HTMLTags but uses js-routines only.

Can I call them with somting like

_IEAction (scriptname,"execute")

Unfortunately the page is in an intranet so I cant show that much.

Any help is welcome!

cu

Werner

Share this post


Link to post
Share on other sites
Bert

Looks like a good start. Take a look here.

http://www.autoitscript.com/forum/index.php?showuser=5125

This is the guy who developed IE.au3. In his signature he has links to tools that can help you. I would NOT send him a PM asking questions. Post your questions here in the forum. I'll monitor this thread to check your progress. Welcome to the forum!

Share this post


Link to post
Share on other sites
falko

Hi,

thanks for the link.

I didn't find anything related to my questions.

I don't see a chance to use the IE-Library without any documentation.

cu

Werner

Share this post


Link to post
Share on other sites
falko

Hi Wolle,

Thanks, that helped a lot.

Your examples work with named elements, which I solved,

but the essential hint was to look at "User Defined Functions->IE Management", where I fond all the methods I was looking for.

Great!

What I need is the "getCollection" methods.

Hopefully this returns some elements, cause IE doesn't even show the source-code of the pages, which makesme some trouble.

But there are no problems, only challenges.

cu

Werner

Share this post


Link to post
Share on other sites
TerarinK

#include <IE.au3>       

ShellExecuteWait("iexplore.exe", "about:blank")
$oIE = _IEAttach("about:blank", "url")
 If @error Then Exit 0

_IENavigate($oIE, "https://...../Login.....")

$o_Form = _IEFormGetObjByName($oIE, "LoginForm")
 If Not @error Then
  $o_Username = _IEFormElementGetObjByName($o_form, "LoginForm:userName")
  $o_Userpassword = _IEFormElementGetObjByName($o_form, "LoginForm:userPassword")
  $o_Login = _IEFormElementGetObjByName($o_form, "LoginForm:Login")
 Else
  MsgBox(0, "Invalid form", "Can't find the 'LoginForm'. Error " & Hex(@error, 8))
  Exit 0
 EndIf

_IEFormElementSetValue($o_Username, <YOUR USERNAME)
_IEFormElementSetValue($o_Userpassword, <YOUR PASSWORD>)
_IEAction($o_Login, "click"
_IELoadWait($oIE)

Loads the IE.au3 file for your use. Loads iexplore.exe and loads up about:blank. Any page found to have about:blank as a url is loaded as oIE, if it does find a error exit the program. Navigate to the desire site which you code in. Find the form you wish to execute, then load everything into the correct place else if you found a error exit the program. Set the values of the things then this is where it becomes kinda confusing, you can _IEAction click it or look in the autoit help on IE.au3 under _IEAction.

The first and second _IELoadWait aren't needed as the operation is done with LoadWait in the function. There truelly is no reason for you to send stuff or move a mouse (just for a side note) in a webpage.

See I come across webpages alot and came up with a way to bypass everything you do here. You can easily do this by looking at every tag on the site and deciding if your can use it to get what you want.

Edited by TerarinK

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
GEOSoft

Take a look at _IEPropertyGet($oIE, "outerhtml") to get the source or see _INetGetSource() under Inet Management in the help file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.