Jump to content
Sign in to follow this  

Click link which contains selected word

Recommended Posts



I have a problem with that and didnt find any solution yet.

I try to click link, which containts word 'yahoo'. For example:

text on the site like:

There is example text


Once again



Thers much links on the site, but I dont know how to find this one and then click.


Share this post

Link to post
Share on other sites

Try this.

; *******************************************************
; Modified example from _IELinkGetCollection  help file - Open browser with AutoIt thread example, get link collection,
;               loop through items and display and click the "Yahoo" associated link URL references
; *******************************************************
#include <IE.au3>

Local $oIE = _IECreate("http://www.autoitscript.com/forum/topic/130400-click-link-which-contains-selected-word/", 1, 1, 1, 1)
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found", 2)

For $oLink In $oLinks
    If StringInStr($oLink.href, "Yahoo") Then
        MsgBox(0, "Link Info", $oLink.href, 2)

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.