Sign in to follow this  
Followers 0
EmptySpace

IE click link by href

4 posts in this topic

#1 ·  Posted (edited)

Hey guys! Need some short line how to click link by href.

For example there is link text

<a href="somelink.php?log=fa09c9d8dee0e47f51be7eb56ebed742&id=kontrolinis&id2=putin"> Visible link text</a>

Yeah, I can use simple _IElinkclickbytext() but it not works correctly.

;

Tried

Local $sMyString = "somelink.php?log=fa09c9d8dee0e47f51be7eb56ebed742&id=kontrolinis&id2=putin"
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
Local $sLinkText = _IEPropertyGet($oLink, "innerText") ;/ and bunch of other like "innerhtml" and so on.
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "click")
ExitLoop
EndIf
Next

;

Thanks

Edited by EdgarT

Share this post


Link to post
Share on other sites



No ideas? Tried bunch of things -.-... I think I need to make something with _IEPropertyGet()

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Take a look at the example for _IELinkGetCollection. Essentially, you are getting reference to the collection of all links, looping through, and when the .href = the .href of the link you want, clicking on it. See my modified example below;

#include <IE.au3>

$oIE = _IECreate("www.google.com")

_IELinkGetCollection($oIE)
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
MsgBox(0, "Link Info", $oLink.href)
If $oLink.href = "http://www.youtube.com/?tab=w1" Then ;click on the youtube link
_IEAction($oLink, "click")
ExitLoop
EndIf
Next

EDIT: If this method doesn't work, you need to be more specific about your problem.

Edited by someone
2 people like this

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Thank you! It works! You made my work easier. :)

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