Jump to content

Clicking unnamed/unid IE button

Recommended Posts

Hi community

Is there a way more 'academic' to achieve this : I intend to click on a button from an IE webpage that has neither id nor name, so selecting it by this way sounds for me impossible

I used a dirty way to achieve this, but would like to be sur that my method is the best one

HTML code

<button title="Ajouter une pièce jointe" class="panel-button sp-attachment-add btn btn-link" role="button" aria-label="Ajouter une pièce jointe" ng-click="attachmentHandler.openSelector($event)"><span class="glyphicon glyphicon-paperclip"></span></button>

My Au3 code

Local $oTags = _IETagNameGetCollection($oIE, "button")
For $oTag In $oTags
    If $oTag.Title == "Ajouter une pièce jointe" Then
        _IEAction($oTag, "click")

Best regards

Link to post
Share on other sites

If the number of buttons is always the same, you could use the index to access directly to the object :

Local $nButton = 2 ; 0 based number = 3rd button
_IEAction(_IETagNameGetCollection($oIE, "button", $nButton), "click")


Link to post
Share on other sites

A strange thing happens when I click on the button

This button opens a "Select file" window. But as soon as the "Select File" window opens , the script freeze as if it can't get out of _IEAction (  $oTag, "click")

The script only follow its way if I set a file or cancel the window :blink:

Is there a way to say "click" and "forget" ??

Link to post
Share on other sites
  • 1 month later...

Indeed, I spent a lot of time anyway to find the tiny part that solves so quickly the problem (at least in my case)

I set the used code in case someone read this and want to save hours of reading :D

Code that freezes

_IEAction($oTag, "click")

Code that runs flawlessly

$hIE = _IEPropertyGet($oIE, "hwnd")
_IEAction($oTag, "focus")
ControlSend($hIE, "", "", "{ENTER}")


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...