Simulate a mouse click on a link with text sub-string matching the string provided.
#include <IE.au3>
_IELinkClickByText(ByRef $o_object, $s_linkText [, $i_index = 0 [, $f_wait = 1]])
| $o_object | Object variable of an InternetExplorer.Application, Window or Frame object |
| $s_linkText | Text displayed on the web page for the desired link to click |
| $i_index | [optional] If the link text occurs more than once, specify which instance you want by 0-based index |
| $f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning |
| Success: | Returns -1 |
| Failure: | Returns 0 and sets @ERROR |
| @Error: | 0 ($_IEStatus_Success) = No Error |
| 1 ($_IEStatus_GeneralError) = General Error | |
| 3 ($_IEStatus_InvalidDataType) = Invalid Data Type | |
| 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type | |
| 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout | |
| 7 ($_IEStatus_NoMatch) = No Match | |
| 8 ($_IEStatus_AccessIsDenied) = Access Is Denied | |
| 9 ($_IEStatus_ClientDisconnected) = Client Disconnected | |
| @Extended: | Contains invalid parameter number |
; *******************************************************
; Example 1 - Open browser with basic example, click on the link
; with text "user forum"
; *******************************************************
#include <IE.au3>
Local $oIE = _IE_Example("basic")
_IELinkClickByText($oIE, "user forum")
; *******************************************************
; Example 2 - Open browser to the AutoIt homepage, loop through the links
; on the page and click on the link with text "wallpaper"
; using a sub-string match.
; *******************************************************
#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")
Local $sMyString = "wallpaper"
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
Local $sLinkText = _IEPropertyGet($oLink, "innerText")
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "click")
ExitLoop
EndIf
Next