Sign in to follow this  
Followers 0
GoogleDude

Question/Problem with _IELinkClickByText

9 posts in this topic

I am trying to automate some webpage tasks. I have been able to get through most of it but am stuck at the last link I need to click on.

The text of the link I am trying to click on is "ClickMe²" notice the small 2 at the end. I think that is what is stopping it from clicking on the text in the link. Plus SCITE is giving me a line error of "IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch" I have tried a few different versions of the string but nothing is working.

How can I match the string to just part of the link text and not the whole string. like just "ClickMe" instead of "ClickMe²"? Or does anyone else have any other ideas?

Thanks,

GoogleDude

Share this post


Link to post
Share on other sites



I am trying to automate some webpage tasks. I have been able to get through most of it but am stuck at the last link I need to click on.

The text of the link I am trying to click on is "ClickMe²" notice the small 2 at the end. I think that is what is stopping it from clicking on the text in the link. Plus SCITE is giving me a line error of "IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch" I have tried a few different versions of the string but nothing is working.

How can I match the string to just part of the link text and not the whole string. like just "ClickMe" instead of "ClickMe²"? Or does anyone else have any other ideas?

Thanks,

GoogleDude

The example 2 script under _IELinkClickByText() in the help file matches partial strings:
#include <IE.au3>
$oIE = _IE_Example ("basic")

$sMyString = "ser for" ; vice "user forum"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks for that. That did help a little. I am now able to verify with your post above that other links on the page are clickable but the button I am trying to click on still doesnt click.

If it helps I put the HTML source I show. The code below is what I pulled off the button when viewing the source in an IE page/object Debugger. Kinda like FireBug does for Firefox.

It apears that the button I am trying to click on is not a standard button or something. I tried clicking by text and by image name or file name path.

Thanks,

<div id=clickonce1 style="display: block; margin-top: 20px">
 
    <table cellpadding=0 cellspacing=0><tr><td><img src="/images/1.jpg" class=bullnum>&nbsp;</td>
    <td>
    <div id="savecancel" class="panelAdd" style="margin-top: 10px">
    <ul class="buttons">
    <li class="buttonLeftmost"></li>
    <li class="buttonLeft"><input type="button" class="buttonAdd" name="apply" onclick="clickOnceStart()" value="ClickMe" /></li>
    <li class="buttonLeftmid"></li>
    </ul>
    </div>

Share this post


Link to post
Share on other sites

$oButton = _IEGetObjByName($oIE, "apply")

_IEAction($oButton, "click")

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

#5 ·  Posted (edited)

$oButton = _IEGetObjByName($oIE, "apply")

_IEAction($oButton, "click")

Dale

Thanks for that however that did not work either.

Below is what I am trying to do and the source I have so far.

I am trying to automate the downloading and installing of LogMeIn Hamachi from an invite link. I am able to get it to get past the first few steps but it doesnt click on the Download Hamachi link. Maybe someone can test it and see what I am talking about. I know there are other ways of this but was hoping to get this method to work as I have it tied in with other mini apps I made in autoit.

Once the hamachi install starts you can stop it with out it installing on the local machine.

Thanks,

#Include  #include  #Include  #include "WinHTTP.au3" #include   $oIE = _IECreate("https://secure.logmein.com/hamachi/ih1.asp?lang=en&c=acu9xu9pma3swmbgr912wf84ptnn96hz5loz5ra1",0,1,1) $oForm = _IEFormGetObjByName ($oIE, "cont") _IELoadWait($oIE) _IEFormElementCheckboxSelect ($oForm, "1", "agree", 1, "byValue") _IEFormSubmit($oForm) _IELoadWait($oIE) $oButton = _IEGetObjByName($oIE, "apply") _IEAction($oButton, "click")   Exit
Edited by GoogleDude

Share this post


Link to post
Share on other sites

The code you posted is garbled for me.

Based on the HTML you posted earlier, the example I gave should have worked. You may have frames or iframes that you need to drill down into -- what output is generated in the SciTe console when you use the code I gave you?

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

Sorry that code tag put everything in 1 line.

#Include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <Constants.au3>
#include "WinHTTP.au3"
#include <IE.au3>

$oIE = _IECreate("https://secure.logmein.com/hamachi/ih1.asp?lang=en&c=acu9xu9pma3swmbgr912wf84ptnn96hz5loz5ra1",0,1,1)
$oForm = _IEFormGetObjByName ($oIE, "cont")
_IELoadWait($oIE)
_IEFormElementCheckboxSelect ($oForm, "1", "agree", 1, "byValue")
_IEFormSubmit($oForm)
_IELoadWait($oIE)
$oButton = _IEGetObjByName($oIE, "apply")
_IEAction($oButton, "click")    
Exit

Share this post


Link to post
Share on other sites

There appears to be some Javascript events tied to that button. You can dig through them to figure out exactly what needs to be done to satisfy them or you can use this work around pulled from the examples for _IEAction:

#include <IE.au3>

$oIE = _IECreate("https://secure.logmein.com/hamachi/ih1.asp?lang=en&c=acu9xu9pma3swmbgr912wf84ptnn96hz5loz5ra1",0,1,1)
$oForm = _IEFormGetObjByName ($oIE, "cont")
_IELoadWait($oIE)
_IEFormElementCheckboxSelect ($oForm, "1", "agree", 1, "byValue")
_IEFormSubmit($oForm)
_IELoadWait($oIE)
$oButton = _IEGetObjByName($oIE, "apply")
_IEAction($oButton, "focus")
$hwnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
Exit

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

#9 ·  Posted (edited)

There appears to be some Javascript events tied to that button. You can dig through them to figure out exactly what needs to be done to satisfy them or you can use this work around pulled from the examples for _IEAction:

#include <IE.au3>

$oIE = _IECreate("https://secure.logmein.com/hamachi/ih1.asp?lang=en&c=acu9xu9pma3swmbgr912wf84ptnn96hz5loz5ra1",0,1,1)
$oForm = _IEFormGetObjByName ($oIE, "cont")
_IELoadWait($oIE)
_IEFormElementCheckboxSelect ($oForm, "1", "agree", 1, "byValue")
_IEFormSubmit($oForm)
_IELoadWait($oIE)
$oButton = _IEGetObjByName($oIE, "apply")
_IEAction($oButton, "focus")
$hwnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
Exit

Dale

Sweet. Thanks. This apears to work.

GoogleDude

Edited by GoogleDude

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