Jump to content

IE click link by href


Recommended Posts

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
Link to comment
Share on other sites

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
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...