Sign in to follow this  
Followers 0
ckelsoe

Best way to tackle this issue

5 posts in this topic

Hi all,

I am working on automating a web application that is very mouse and keyboard intensive to do even simple task. I have made great progress using the Send and MouseClick x,y type of coding. I am interested in trying to make the code more robust since stuff moves around on the screen depending on the resolution as well as to try to not be quite as window position oriented.

This app is running in IE. One thought is to be able to look at the source - the following for example I would like to insert data into the password field:

<input name="ctl00$DefaultContent$txtPassword" type="password" id="ctl00_DefaultContent_txtPassword" class="FormTextInput" />

In this example I want to click the link at the word "assignment":

<td bgcolor='#f1f1f1' height='9'><font face='verdana, arial' color='#ffffff' size='1'><a class='TabText10' href='assignment.asp?sid=2&bid=131'>assignment</a></font></td>

The other thing I could use some suggestions on is how to determine what is on the display. The IE title never changes even when a different pages of data is shown.

I would also like to retrieve the value of a field like the one below:

<input type='hidden' name='thedate' value='08/19/2013'>

I am not sure how to best try to use this information in my code and logic. Any direction would be appreciated.

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

look into the helpfile, the _IE_Example() ff functions offer all you want. study the examples. it's a bit tricky, but you can automate almost everything.

E.

; *******************************************************
; Example 1 - Open a browser with the form example, click on the
;               <input type=image> form element with matching alt text
; *******************************************************

#include <IE.au3>

Local $oIE = _IE_Example("form")
_IEFormImageClick($oIE, "AutoIt Homepage", "alt")

; *******************************************************
; Example 2 - Open a browser with the form example, click on the <input type=image>
;               form element with matching img source URL (sub-string)
; *******************************************************

#include <IE.au3>

$oIE = _IE_Example("form")
_IEFormImageClick($oIE, "autoit_6_240x100.jpg", "src")

; *******************************************************
; Example 3 - Open a browser with the form example, click on the
;               <input type=image> form element with matching name
; *******************************************************

#include <IE.au3>

$oIE = _IE_Example("form")
_IEFormImageClick($oIE, "imageExample", "name")

.

,

; *******************************************************
; Example 1 - Open a browser with the form example, set the value of a text
;               form element, retrieve and display the value from the element
; *******************************************************

#include <IE.au3>

Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
Local $oText = _IEFormElementGetObjByName($oForm, "textExample")
Local $IEAu3Version = _IE_VersionInfo()
_IEFormElementSetValue($oText, $IEAu3Version[5])
MsgBox(0, "Form Element Value", _IEFormElementGetValue($oText))

.

very useful are the "developer tools" in the Extras menu of ie. they give you the structure of the html code.

Edited by Edano
1 person likes this

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

Thanks - that helps a lot.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks - that helps a lot.

.

yeah, you will be very satisfied once you manage to understand the logic :)

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

Finally getting some time to start playing with this. In the example above the code "Local $oIE = _IE_Example("form")" refers to "_IE_Example". Is that function specific to this example or is it a real function that I would use in my code? I am not quite clear on how this should be used in my code

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