Sign in to follow this  
Followers 0
urklnme

click Button in frame

5 posts in this topic

I am on a page with six frames. I have selected a frame named "contentFrame". On this frame there is a row of buttons. I want to click the 5th button that reads "Export Grid". In the source of the content frame appears:

body onload

table class = "buttons"

tr

td

.

.

.

<a class="buttons" onclick="exportGrid(&quot;main?command=ExportGrid&amp;dbid=3369174

I have tried getting collections of all sorts, getting object by name, even tried to msgbox the names of all object in the frame. I tried to open frame in new window. The current state of the code:

$oFrame = _IEGetObjById($oIE, "contentFrame") ; works

MsgBox(0, "Frame Info", $oFrame.name) ; works

$sSrc = $oFrame.src

$oIE2 = _IEAttach($sSrc)

$colTags = _IETagNameAllGetCollection ($oIE2)

For $oTag In $colTags ; ERROR no object here

MsgBox(0, "button Info", _IEPropertyGet($oTag, "innertext"))

If _IEPropertyGet($oTag, "innertext") = "exportGrid" Then

_IEAction($oTag, "click")

EndIf

Next

no matter what I have tried I have not been able to get any objects that belong to the frame.

I am a rookie to HTML and AUTOIT.....This is definitely a IATK error ARGH!!!!!

Share this post


Link to post
Share on other sites



I am on a page with six frames. I have selected a frame named "contentFrame". On this frame there is a row of buttons. I want to click the 5th button that reads "Export Grid". In the source of the content frame appears:

body onload

table class = "buttons"

tr

td

.

.

.

<a class="buttons" onclick="exportGrid(&quot;main?command=ExportGrid&amp;dbid=3369174

I have tried getting collections of all sorts, getting object by name, even tried to msgbox the names of all object in the frame. I tried to open frame in new window. The current state of the code:

$oFrame = _IEGetObjById($oIE, "contentFrame") ; works

MsgBox(0, "Frame Info", $oFrame.name) ; works

$sSrc = $oFrame.src

$oIE2 = _IEAttach($sSrc)

$colTags = _IETagNameAllGetCollection ($oIE2)

For $oTag In $colTags ; ERROR no object here

MsgBox(0, "button Info", _IEPropertyGet($oTag, "innertext"))

If _IEPropertyGet($oTag, "innertext") = "exportGrid" Then

_IEAction($oTag, "click")

EndIf

Next

no matter what I have tried I have not been able to get any objects that belong to the frame.

I am a rookie to HTML and AUTOIT.....This is definitely a IATK error ARGH!!!!!

Why are you using $oFrame.src with _IEAttach()? Are you trying to work around some cross-site scripting restrictions?

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I indicated in the op that I am new to this. I have spent a couple of hours on this so far. I have tried many combinations of many different commands. what you see was just the current state of the code. actually I have already taken that out and tried other commands. I will probably try tabbing to the button next.

If you know an effective way to find the collection of objects in a frame and click on a button in a frame I would appreciate the knowledge.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I indicated in the op that I am new to this. I have spent a couple of hours on this so far. I have tried many combinations of many different commands. what you see was just the current state of the code. actually I have already taken that out and tried other commands. I will probably try tabbing to the button next.

If you know an effective way to find the collection of objects in a frame and click on a button in a frame I would appreciate the knowledge.

I think you need to spend some time trying out the example scripts for the various _IE* functions. It is a learning curve that is well worth climbing. This may list the tags you are interested in by index:
$oFrame = _IEGetObjById($oIE, "contentFrame")
$colTags = _IETagNameGetCollection($oFrame, "a")
$iTagCnt = @extended
ConsoleWrite("There are " & $iTagCnt & " 'a' tags in the frame." & @LF)
$i = 0
For $oTag in $colTags
    If $oTag.class = "buttons" Then
        ConsoleWrite("'a' tag index " & $i & " matches class = buttons" & @LF)
    EndIf
    $i += 1
Next

The problem is that you don't show the full 'a' tag. If there is no HREF section to the tag, then it should have a 'name' property set that would allow addressing it directly. Practice with the examples in the help file and it will become clearer how to do that.

:P

Edit: Reference: MSDN: "a Object":

Remarks

The a element requires the href or the name property to be specified.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Yes I agree.... Autoit is a great tool and well worth further reading. I, like many others, rushed into a script because Autoit is just that cool!! :P

I have many other tasks in my daily/weekly work that I would like to automate so I will definitely be learning more.

Thanks indeed for the replies.

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