Jump to content

Need help with getting properties for _IELinkGetCollection


Recommended Posts

================================

#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)
================================

How do I find out what the other properties are?

i.e.  $oLink.href

href is a property that the script is looping through. How do I find what other properties exist ? ( I'm interested in correlating the text/image for each href, how do I find out what the name of the property for the text is?

Thanks,

Van

Link to comment
Share on other sites

I would suggest Chrome, or Firefox (IE can work too, but there's too much clicking).

Chrome, Firefox:
Open a page you're interested in inside Firefox or Chrome, right mouse click on the link you're interested in, and then click INSPECT ELEMENT, and you'll see all properties of that link.

As for IE:

Open a page you're interested in, press F12 (OR click the "gear" icon, and then click on "F12 Developer tool"), Click the "arrow"-looking icon in the toolbar of the new Developer Tool window, and then click on the link you're interested in inside IE window. On the right side of the Developer tool window, click "Attributes", "Style".. or whatever you're interested in to see the properties.

Link to comment
Share on other sites

Yup:

 

#include <IE.au3>
#include <Array.au3>

$oIE = _IECreate()

Local $sHTML = '<html><body><img src="http://aut1.autoit-cdn.com/site/wp-content/themes/TheCorporation/images/logo@2x.png" width="210" height="72" alt="AutoItScript" id="logo" /></body></html>'
_IEBodyWriteHTML($oIE, $sHTML)

Local $RetArray[1][2]

Local $OneImage = _IEGetObjById($oIE, 'logo')
If IsObj($OneImage) Then
    Local $AttrObj = $OneImage.attributes
    If IsObj($AttrObj) Then
        Local $TotalNumberOFAttr = $AttrObj.length
        For $i = 0 to $TotalNumberOFAttr-1
            Local $PropertyName = $AttrObj.item($i).nodeName
            Local $PropertyValue = $AttrObj.item($i).nodeValue
            If $PropertyValue <> '' Then _ArrayAddEx($RetArray, $PropertyName, $PropertyValue)
        Next
    EndIf
EndIf

_ArrayDisplay($RetArray)

_IEQuit($oIE)

Func _ArrayAddEx(ByRef $__Array, $value1, $value2)
    ReDim $__Array[UBound($__Array)+1][2]
    $__Array[0][0] = UBound($__Array)-1
    $__Array[UBound($__Array)-1][0] = $value1
    $__Array[UBound($__Array)-1][1] = $value2
EndFunc
Edited by dragan
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

×
×
  • Create New...