litlmike Posted November 3, 2006 Share Posted November 3, 2006 I need to test is a page has the link titled "Next". Can I use _IELinkGetCollection to do that? I am not testing for the URL, just the title of the link.Or is there some crazy way to use _IELinkClickByText that does not have to click on the link first, to test if it exists?Thanks in Advance. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 3, 2006 Moderators Share Posted November 3, 2006 Here you go. $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.outerText = "Next" Then $fMatch = True EndIf Next Link to comment Share on other sites More sharing options...
litlmike Posted November 3, 2006 Author Share Posted November 3, 2006 Thanks! Wow big_daddy, that 6 lines of code created so many more questions for me. But first thing first, lets figure this out. Why does this slight modification always show up true, when the .outerText "Next" is not on the page? #include <IE.au3> $oIE = _IE_Example ("basic") $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.outerText = "Next" Then $fMatch = True MsgBox(4096, "Success", "Dance!", 3) EndIf Next _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 3, 2006 Moderators Share Posted November 3, 2006 If the links text is null (i.e. the image) then the .outerText Method will return 0 (zero). With that in mind if you compare a number to a string it always returns true. The simple fix is to change the return value into a string before comparing. #include <IE.au3> $oIE = _IE_Example ("basic") $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If String($oLink.outerText) = "Next" Then $fMatch = True MsgBox(4096, "Success", "Dance!", 3) EndIf 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