vrsrinivas2000

Find Links in page

3 posts in this topic

#1 ·  Posted

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("basic")
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended

Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
For $oLink In $oLinks
    $sTxt &= $oLink.href & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt)

 

This is work for only this url, But did not work other urls like "https://tools.usps.com/go/ZipLookupAction!input.action"

I get the error as below

Variable must be of type "Object".:

For $oLink In $oLinks
For $oLink In $oLinks^ ERROR

 

Please suggest.

Share this post


Link to post
Share on other sites



#2 ·  Posted

Try adding _IELoadWait($oIE) after "Local $oIE = ....

Share this post


Link to post
Share on other sites

#3 ·  Posted

Try:
 

#include <IE.au3>
#include <MsgBoxConstants.au3>

Global Const $iLink = "https://tools.usps.com/go/ZipLookupAction!input.action"

Local $oIE = _IECreate($iLink)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "!", "_IECreate Error: " & @error)
Local $oLinks = _IELinkGetCollection($oIE)
Local $iError = @error
Local $iNumLinks = @extended
If Not $iError And IsObj($oLinks) Then
    Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
    For $oLink In $oLinks
        $sTxt &= $oLink.href & @CRLF
    Next
    MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt)
Else
    Exit MsgBox($MB_SYSTEMMODAL, "!", "Get Link Error: " & $iError)
EndIf

 


Regards,
 

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