Sign in to follow this  
Followers 0
haggard

Click link which contains selected word

3 posts in this topic

Hi,

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

http://google.com

Once again

http://yahoo.com/asbajkadsn213

etc...

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

Thanks

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)
        $oLink.click
    EndIf
Next

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