cocoboyt Posted February 14, 2012 Share Posted February 14, 2012 Hello, I've searched and searched for this but couldn't find enough information to help me. Plus I'm new to AutoIt. I'm trying to click a text in IE. It's not a link, so _IELinkClickByText doesn't help. I attempted to get the coordinates of the text and simply mouseclick it. Unfortunately, I haven't been very successful in getting the coordinates either.... The text triggers a hide/unhide of options below it. I also cannot tab to it. Any help/guidance would be greatly appreciated. Thanks, Joe Link to comment Share on other sites More sharing options...
RobGuy Posted February 14, 2012 Share Posted February 14, 2012 If you have a look at the code of the page and find the object that says the "onclick='.....'" which triggers the hide/unhide in question then get hold of a reference to that object using something like getElementById or getElementsByTagName(though this one would require iteration over the collection to find the specific element you want) then fire the ol' onclick programmatically .. a super simplified example of what I mean: Opt("MustDeclareVars", 1) Local $oIE = ObjCreate("InternetExplorer.Application") $oIE.Visible = True $oIE.Navigate("About:Blank") While $oIE.ReadyState <> 4 Sleep(250) WEnd Local $oDiv = $oIE.document.createElement('div'); $oDiv.ID = "oDiv" $oDiv.InnerHTML = "<div onclick=""alert('Clicked!');"" id=""oDiv1"">Hey there</div>" _ & "<div onclick=""document.getElementById('oDiv1').click()"">Why hello</div>" _ & "<div onclick=""document.getElementById('oDiv1').fireEvent('onclick')"">ahoy!</div>" $oIE.Document.Body.appendChild($oDiv) $oDiv = $oIE.document.getElementById("oDiv1") $oDiv.Click() $oDiv.fireEvent('onclick') Link to comment Share on other sites More sharing options...
cocoboyt Posted February 14, 2012 Author Share Posted February 14, 2012 Thanks! onclick = $(function(){ if ($('.property0').hasClass('hidden')) { $('.property0').slideDown('slow');$('.property0').removeClass('hidden'); } else { $('.property0').slideUp('slow'); $('.property0').addClass('hidden');} }); I haven't looked into doing it this way yet. I'll have to read more into getElements. Link to comment Share on other sites More sharing options...
cocoboyt Posted February 15, 2012 Author Share Posted February 15, 2012 Hello, I think I'm a bit in over my head for this one. I found the "onclick", but I cannot find an ID. I attached some screenshots. I want AutoIt to click the "Options". The boxs are IE developer Class/ID view. The second is the Element attributes of "Options". I'm probably missing something due to my lack of understanding, so I apologize. I'm still learning AutoIt. Thank you much in advance. Joe Link to comment Share on other sites More sharing options...
cocoboyt Posted February 15, 2012 Author Share Posted February 15, 2012 I attached some other screenshots. Link to comment Share on other sites More sharing options...
cocoboyt Posted February 15, 2012 Author Share Posted February 15, 2012 Anyone available for some advice? Thanks Link to comment Share on other sites More sharing options...
Robjong Posted February 15, 2012 Share Posted February 15, 2012 (edited) Can you post the URL of the page? After reading your second post I realized that was all we need. Give this a try, it's does not do the fancy slide animation but I guess you don't need that (if you do it is simple enough) Local $sClass = 'property0' ; the class name of the tag we need (note that the leading dot is not present) Local $oTags = _IETagNameGetCollection($oIE, 'div') ; get tag collection, replace the 'div' with the tag you are looking for For $oTag In $oTags ; loop over all tags in the collection If StringRegExp($oTag.className, 'b' & $sClass & 'b(?=.*?bhiddenb)') Then ; we have a tag with class $sClass and 'hidden', basicly the same as $(tag).hasClass('hidden') $oTag.className = StringReplace($oTag.className, 'hidden', '') ; remove the 'hidden' class EndIf Next Edited February 15, 2012 by Robjong Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now