continyu Posted July 12, 2010 Share Posted July 12, 2010 Hi there, I have to click some links in a web page. There are links like this; www.somesite.com/some.php?99999 I want to click all links start with www.somesite.com/some.php the number "99999" is the user id's so they are changing every time. How can i click all links without consider about user id'S (of course there are a lots of links in same page i want to select links only start with www.somesite.com/some.php) I know a little about ie actions and ie.udf but i don't know how to find this specific links... Thank you all Link to comment Share on other sites More sharing options...
StandardUser Posted July 12, 2010 Share Posted July 12, 2010 (edited) Did you try searching the help file? There is very similar example in _IELinkGetCollection function reference. Just parse the link href with string functions Edited July 12, 2010 by 871 Link to comment Share on other sites More sharing options...
continyu Posted July 12, 2010 Author Share Posted July 12, 2010 yep but it is working with link text. i want to work by html link code? Link to comment Share on other sites More sharing options...
StandardUser Posted July 12, 2010 Share Posted July 12, 2010 Try this (not tested) #include <IE.au3> $oIE = _IECreate ("www.somesite.com") $oLinks = _IELinkGetCollection ($oIE) For $oLink In $oLinks If StringInStr($oLink.href, "www.somesite.com/some.php") Then _IEAction($oLink, "click") Next Link to comment Share on other sites More sharing options...
continyu Posted July 12, 2010 Author Share Posted July 12, 2010 I think your code wasn't working (but i can be mistaken ) BUT simply this worked when i edited your code; #include <IE.au3> $oIE = _IECreate("http://www.somesite.com/") $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks $findlink = StringInStr($oLink.href, "http://www.somesite.com/some.php") If $findlink = 0 Then Sleep(10) Else _IEAction($oLink, "click") MsgBox(0,"OK","Clicked") EndIf Next Thank you very much for your help! I will give your credits if i will be able to finish my script Link to comment Share on other sites More sharing options...
StandardUser Posted July 12, 2010 Share Posted July 12, 2010 Yep, I forgot to check return value of StringInStr, to keep the code more compact, you could do like this #include <IE.au3> $oIE = _IECreate ("www.somesite.com") $oLinks = _IELinkGetCollection ($oIE) For $oLink In $oLinks If StringInStr($oLink.href, "www.somesite.com/some.php")> 0 Then _IEAction($oLink, "click") Next Link to comment Share on other sites More sharing options...
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