EmptySpace Posted September 2, 2012 Posted September 2, 2012 (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 September 2, 2012 by EdgarT
EmptySpace Posted September 3, 2012 Author Posted September 3, 2012 No ideas? Tried bunch of things -.-... I think I need to make something with _IEPropertyGet()
someone Posted September 3, 2012 Posted September 3, 2012 (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 September 3, 2012 by someone SkysLastChance and jobotATX 2 While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
EmptySpace Posted September 3, 2012 Author Posted September 3, 2012 Thank you! It works! You made my work easier.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now