Sign in to follow this  
Followers 0
Lord Maim

Affecting Form Elements on Pre-existing Webpages

10 posts in this topic

Good morning all,

This is likely a newbie question. I'm trying to create a set of scripts to automate a web based application that we use at my work, and have been doing a lot of research on AutoIT. After discovering the IE.au3 library, and what it can do, I'm convinced that AutoIT can do what I need it to, but I'm still getting a handle on the syntax needed.

The web based app opens many child windows with various names that I need to affect with my script. I've looked over the examples of various IE.au3 functions such as "_IEFormElementSetValue" but all the examples seem to only refer to windows opened by the script itself, and I'm not quite sure how to affect an existing window by name.

For the ease of reference, let's say that I have a browser open to http://www.ebgames.com/ and I wanted to select a particular category on the drop down box on the upper left corner.

Maim

P.S. Yes, newbie question, but at least I can spell correctly. :)

Share this post


Link to post
Share on other sites



I should also mention that while the child windows that the app open have the same title, but a unique URL each time, and it is these windows that I am trying to affect. Any suggestions?

Share this post


Link to post
Share on other sites

Take a look at _IEAttach

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

DOH. Thanks very much!

Share this post


Link to post
Share on other sites

Its amazing the difference a week will make when you're moving in the right direction. Alright, I've been able to get all the proper names of elements using some of the handy scripts in the forums, and have associated them with objects. Again though I'm looking for a command that is probably there somewhere, but I can't seem to find.

I've found _IELoadWait which waits for a particular page to load, but is there a command that will pause the script while a particular frame loads? Basically, the framed web application that we use has a combo box in a frame that upon selecting an option in it, updates the frame that the combo box is in. So I have to wait for it to load before continuing to affect that frame.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Just get a reference to the specific frame and use it with load wait.

_IELoadwait will work with a frame object? To be honest, I didn't even try it. For futher clarification, when the help file says "Object variable of an InternetExplorer.Application" does that mean that any object will work? (i.e. frame, form, page, etc?)

Also, when a frame displays page A, displays another page, and then back to page A again, do I have to reacquire the objects on page A?

EDIT: It doesn't seem to work. I know I have the right object references, because it works with a sleep command. The answer to this might lie with the answer to my object reference question above...

Edited by Lord Maim

Share this post


Link to post
Share on other sites

_IELoadwait will work with a frame object? To be honest, I didn't even try it. For futher clarification, when the help file says "Object variable of an InternetExplorer.Application" does that mean that any object will work? (i.e. frame, form, page, etc?)

Also, when a frame displays page A, displays another page, and then back to page A again, do I have to reacquire the objects on page A?

EDIT: It doesn't seem to work. I know I have the right object references, because it works with a sleep command. The answer to this might lie with the answer to my object reference question above...

A Frame is actually a window object that can contain a document. When the frame navigates to a new location, the document in it and all objects are destroyed and you must re-instantiate your object references. IE.au3 hides some of the complexities of this from you by allowing a window or browser as the first parameter of most functions -- then it drills to the current document for you without you needing to worry about it. The objects inside a document are a different story however and you need to reconnect to them.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

oops... unintentional post.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Great, thanks alot Dale. After making some functions to reconnect the objects when frames refresh, the code works perfectly. That really helps.

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  
Followers 0