MrTieDye Posted January 13, 2015 Posted January 13, 2015 (edited) I have just began to play around with the IE UDF. I am running into a problem where certain buttons I want to click do not have a name or id value. For example <button onclick="dosomething()">A button</button> Is there a way to find this button based on the division it is contained within or the text displayed on the button? I found _IELinkClickByText(), but it doesn't seem to work for buttons. Is there something similar to _IEButtonClickByText() maybe? EDIT: I should also note that these buttons are not part of a form, so I can't use _IEFormGetCollection(). Edited January 13, 2015 by MrTieDye
JohnOne Posted January 14, 2015 Posted January 14, 2015 Will help people help you, if you show a significant amount of the containing HTML or better still a link to the page. Things like _IETagNameGetCollection will help and using index numbers. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators SmOke_N Posted January 14, 2015 Moderators Posted January 14, 2015 What JohnOne said... but, you can loop through the indexes and use innerText to match your criteria. This is a function (it will be a bit different as I'm going to add byValue as well) that I'll be including in my IEJS.au3 library, see if it helps. expandcollapse popupFunc _IEJS_GetObjByText(ByRef $oObj, $sInnerText, $sTag = "", $iIndex = -1, $bInStr = False) If Not IsObj($oObj) Then Return SetError($_IESTATUS_InvalidDataType, 1, 0) EndIf $sTag = (IsKeyword($sTag) Or Not StringLen($sTag)) ? "" : $sTag $iIndex = (IsKeyword($iIndex) Or $iIndex < 0) ? -1 : $iIndex Local $oTags = (StringLen($sTag)) ? _IETagNameGetCollection($oObj, $sTag, $iIndex) : _ _IETagNameAllGetCollection($oObj, $iIndex) Local $iExtended = @extended If Not IsObj($oTags) Then Return SetError($_IESTATUS_NoMatch, 2, 0) EndIf Local $aRet[$iExtended], $iCount For $oTag In $oTags If $bInStr Then If StringInStr($oTag.innerText, $sInnerText) Then $aRet[$iCount] = $oTag $iCount += 1 EndIf Else If String($oTag.innerText) = $sInnerText Then $aRet[$iCount] = $oTag $iCount += 1 EndIf EndIf Next If Not $iCount Then Return SetError($_IESTATUS_NoMatch, 3, 0) EndIf ReDim $aRet[$iCount] Return SetError($_IESTATUS_Success, 1, 1) EndFunc It returns an array of objects (or no array/error) found. Hope you know how to work with arrays . Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
MrTieDye Posted January 14, 2015 Author Posted January 14, 2015 Thank you for your replies. I tried to tinker with the info you provided, but I didn't get very far. I am sure the fault lies with me, not with the information you provided. I am a hobbyist programmer. I have learned everything I know about programming from books and various tutorials and such on the internet. I started with QBasic in 1996, so I have been at this a while. I am not bragging, just letting you know where I am coming from. I have used AutoIt on and off for various projects over the years, but I am not intimate with it. To be honest, I mainly use it to write video game bots. *ducks behind a large rock* The project I am currently working on involves a "bot" for a browser based game. I don't really understand what an Object Collection is, much less what to do with it once I have created one. I have Googled until my eyes started watering, and I still haven't found a satisfactory answer. Perhaps I should start there. Could someone point me to a tutorial that breaks down IE UDF's Object Collection to a Sesame Street level?
Moderators SmOke_N Posted January 14, 2015 Moderators Posted January 14, 2015 At the top of this forum, and at the bottom right of every page, there are the Forum Rules. Unfortunately you've broken a cardinal rule, no need to duck, the RPG blew the rock all to hell. Please don't post for help on games/botting and read the forum rules. Topic closed Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts