Sign in to follow this  
Followers 0
NSearch

_IE.au3 image click problems

11 posts in this topic

#1 ·  Posted (edited)

I have been working with this all day. I can not seem to get this right.

I am trying to click on the following link. (which is an image)

<input type="image" src="/img/en/btn_lnk_view.gif" WIDTH="138" HEIGHT="14" align="top" border="0" alt="View progress" name="tdm">

I was using

$o_Submit_Print = $oIEPrint.document.getElementById("tdm")
$o_Submit_Print.click

but then realized that the name changes each time (i.e. name="tdm" could be name="tts" next time).

The image is in the 3rd form on the page, and is the 11th input tag in that form.

Would someone please guide me in the right direction.

Thanks.

Edited by NSearch

Share this post


Link to post
Share on other sites



There is a stinky problem here in that <input type="image"> elements are not included in the form element collection. This is certainly not intuitive and I believe it has something to do with when the tag was introduced (later in the development of the DOM).

One way to get it would be to access it within the collection of all page elements (by index) or create a virtual collection of elements with tagname "input" and access it by index in that collection (see the 'tagname' related functions in IE.au3)

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

Still having problems. Please advise. Thank you Dale for all of your help.

$form_collection = _IEFormGetCollection ($oIEPrint.document)
        $button_name = _IEFormElementGetObjByIndex($form_collection, 10)
        $button_name.click

Share this post


Link to post
Share on other sites

Still having problems. Please advise. Thank you Dale for all of your help.

$form_collection = _IEFormGetCollection ($oIEPrint.document)
        $button_name = _IEFormElementGetObjByIndex($form_collection, 10)
        $button_name.click
Type=image elements will not be included in your _IEFormElementGetObjByIndex -- please reread my last reply and let me know if it still isn't clear and I'll try to explain it a different way.

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

This is a difficult concept for me to grasp obviously. I am still having trouble. I believe that I am grabbing all the tags in the source code. But I am not familiar with the syntax for the next statement.

$tag_collection = _IETagNameAllGetCollection($oIEPrint)

Also, would I count the number of <input tags to get to the img that I want to click?

Once I figue out how to access that element, do I user $variable.click or _IESubmit($variable)

Thanks!

Share this post


Link to post
Share on other sites

This is a difficult concept for me to grasp obviously. I am still having trouble. I believe that I am grabbing all the tags in the source code. But I am not familiar with the syntax for the next statement.

$tag_collection = _IETagNameAllGetCollection($oIEPrint)

Also, would I count the number of <input tags to get to the img that I want to click?

Once I figue out how to access that element, do I user $variable.click or _IESubmit($variable)

Thanks!

The following should work for you. One source of confusion is that the TagName functions need a pointer to the document object rather than just the browser object. This was done so that different lacations in the DOM tree could be used to scope the collection. I try to prevent the need to specify the document object in most calls and I'll do something in a fture release to test if it was a browser object passed in and append the .document level if so).

$tag_collection = _IETagNameGetCollection($oIEPrint.document, "input")
For $t in $tag_collection
    If $t.type = "image" and $t.src = "/img/en/btn_lnk_view.gif" Then
        $t.click
        ExitLoop
    EndIf
Next

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

Thanks Dale Very Much!

Share this post


Link to post
Share on other sites

i too had this problem. i had to resort to searching for the image on the screen and using MouseClick() on the x,y coords. certainly not ideal!

Share this post


Link to post
Share on other sites

i too had this problem. i had to resort to searching for the image on the screen and using MouseClick() on the x,y coords. certainly not ideal!

The solution provided in reply 6 and similar methods will work without having to resort to mouse coords.

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

The solution provided in reply 6 and similar methods will work without having to resort to mouse coords.

yes, except for the fact that when you click an image like this it send the x,y coords of where you clicked. i needed to click in particular places! is there a way to pass that to $image.click?

Share this post


Link to post
Share on other sites

yes, except for the fact that when you click an image like this it send the x,y coords of where you clicked. i needed to click in particular places! is there a way to pass that to $image.click?

There are ways of passing the coords in an event object and I played with it a bit a while back, but didn't get a working example... someday...

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

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