taurus905 Posted November 19, 2012 Share Posted November 19, 2012 I've been trying to use the IE.au3 UDF to click on the "Add to Internet Explorer" button on the following webpage:http://www.iegallery.com/en-us/Addons/Details/813What I thought would be a relatively simple task has me perplexed.I cannot get _IELinkClickByText to work and have searched the entire forum for an alternate solution.Windows 7-64 bit with IE9Please point me in the right direction.Thank you in advance for any help or example you can provide.taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
ileandros Posted November 19, 2012 Share Posted November 19, 2012 (edited) #include <IE.au3> Local $String = "Add to Internet Explorer" $oIE = _IECreate("http://www.iegallery.com/en-us/Addons/Details/813") Local $Links = _IELinkGetCollection($oIE) For $Link In $Links Local $Text = _IEPropertyGet($Link, "outertext") ConsoleWrite($Text & @CRLF) If StringInStr($String,$Text) Then MsgBox(0,"Voila!","Text found!") ExitLoop Else ContinueLoop EndIf Next Check if this will find it. Edit: As i saw your button is a span... Edited November 19, 2012 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
taurus905 Posted November 19, 2012 Author Share Posted November 19, 2012 Thank you for the reply, ileandros. Your script does find the button text "Add to Internet Explorer". But after I added the following line of code, it does not click the button. Am I using the wrong function? _IELinkClickByText($oIE, $Text) #include Local $String = "Add to Internet Explorer" $oIE = _IECreate("http://www.iegallery.com/en-us/Addons/Details/813") Local $Links = _IELinkGetCollection($oIE) For $Link In $Links Local $Text = _IEPropertyGet($Link, "outertext") ConsoleWrite($Text & @CRLF) If StringInStr($String,$Text) Then MsgBox(0,"Voila!","Text found!",1) _IELinkClickByText($oIE, $Text) ExitLoop Else ContinueLoop EndIf Next "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
somdcomputerguy Posted November 19, 2012 Share Posted November 19, 2012 Does this help?RemarksNot all elements that appear to be links actually are. It is common practice to attach onclick Javascript events to other DOM elements to simulate the behavior of links. To activate such elements, use "click" with _IEAction.Function _IELinkClickByText - http://www.autoitscript.com/autoit3/docs/libfunctions/_IELinkClickByText.htm - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
taurus905 Posted November 19, 2012 Author Share Posted November 19, 2012 Does this help? Function _IELinkClickByText - http://www.autoitscript.com/autoit3/docs/libfunctions/_IELinkClickByText.htm Hello somdcomputerguy, I read the above earlier and have tried many different things without success. I feel the clues are in the portion of the source code listed below. Thanks for your help. taurus905 <div id="download_addon"><span> <a href="javascript:BrowserDetectionAddonInstallSearch('/en-us/AddOns/DownloadAddOn?resourceId=813','False', '813', '00000000-0000-0000-0000-000000000000');" class="button orange_gradient trackDownload" id="install_addon" data-type="SearchProvider" data-name="Google Search" data-partner="Google" data-id="813"> Add to Internet Explorer</a> </span> </div> "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
ileandros Posted November 19, 2012 Share Posted November 19, 2012 It's a span. I havent messed with IE for long time but try _IETagnameGetCollection() I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
DaleHohm Posted November 19, 2012 Share Posted November 19, 2012 There is something in the javascript action that is preventing a simple click action to not perform the button activation. This code will get you further... then look at the second example for _IEAction for tips on how to deal with the popup. Dale #include <IE.au3> $oIE = _IEAttach("Internet Explorer Gallery") $oAs = _IETagnameGetCollection($oIE, "a") for $oA in $oAs If StringInStr($oA.innertext, "Add to Internet Explorer") Then _IEAction($oA, "focus") $hwnd = _IEPropertyGet($oIE, "hwnd") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") EndIf Next 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 Link to comment Share on other sites More sharing options...
taurus905 Posted November 20, 2012 Author Share Posted November 20, 2012 It's a span.I havent messed with IE for long time but try _IETagnameGetCollection()ileandros,Thank you for your help. You were right. _IETagnameGetCollection() was the answer.taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
taurus905 Posted November 20, 2012 Author Share Posted November 20, 2012 There is something in the javascript action that is preventing a simple click action to not perform the button activation. This code will get you further... then look at the second example for _IEAction for tips on how to deal with the popup. Dale #include <IE.au3> $oIE = _IEAttach("Internet Explorer Gallery") $oAs = _IETagnameGetCollection($oIE, "a") for $oA in $oAs If StringInStr($oA.innertext, "Add to Internet Explorer") Then _IEAction($oA, "focus") $hwnd = _IEPropertyGet($oIE, "hwnd") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") EndIf Next Dale, Thank you for taking the time to resolve my issue. Your example worked perfectly. You're the man! taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs 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