jdelaney Posted May 18, 2012 Share Posted May 18, 2012 (edited) Launch an IE 9@ google.com, and then run the following... #include <IE.au3> #include <Array.au3> $oObj = _IEAttach("google") $colNode = _IETagNameGetCollection ( $oObj, "input" ) For $Node In $colNode MsgBox ( 4096, "test", $Node.attributes.length & " " & $Node.outerhtml) $colAttr = $Node.attributes Dim $aitests[$colAttr.length][4] For $Attr in $colAttr $aitests[$i][0] = $Attr.Name $aitests[$i][1] = $Attr.Value $aitests[$i][2] = $Attr.NodeName $aitests[$i][3] = $Attr.NodeValue ;msgbox ( 4096, "test", "colNode.length=" & $colNode.Length & " colAttr.length=" & $colAttr.length & " Attr.nodename=" & $Attr.NodeName & " Attr.nodevalue=" & $Attr.NodeValue & " Attr.name=" & $Attr.Name & " Attr.Value=" & $Attr.Value ) Next _ArrayDisplay ( $aitests ) Next The first message box will show there are only 2 attributes...but then, actually getting the .attributes of each node results in over 100 returns. Anyone sure why? And those that are returned, none match what are in the actual attributes. The .attributes works fine on XMLdom objects. Edited May 18, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
JohnOne Posted May 18, 2012 Share Posted May 18, 2012 I'd fix script if I were you, since you are asking people to run it. Where does $i come from? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jdelaney Posted May 18, 2012 Author Share Posted May 18, 2012 (edited) haha, you solved my issue, thanks. I happened to have an $i declared (above the piece i copied in), so it worked, but did not reutrn what was expected...fixed: #include <IE.au3> #include <Array.au3> $oObj = _IEAttach("google") $colNode = _IETagNameGetCollection ( $oObj, "input" ) For $Node In $colNode MsgBox ( 4096, "test", $Node.attributes.length & " " & $Node.outerhtml) $colAttr = $Node.attributes Dim $aitests[$colAttr.length][4] $i = 0 For $Attr in $colAttr $aitests[$i][0] = $Attr.Name $aitests[$i][1] = $Attr.Value $aitests[$i][2] = $Attr.NodeName $aitests[$i][3] = $Attr.NodeValue ;msgbox ( 4096, "test", "colNode.length=" & $colNode.Length & " colAttr.length=" & $colAttr.length & " Attr.nodename=" & $Attr.NodeName & " Attr.nodevalue=" & $Attr.NodeValue & " Attr.name=" & $Attr.Name & " Attr.Value=" & $Attr.Value ) $i = $i + 1 Next _ArrayDisplay ( $aitests ) Next Oh, and FYI, .attributes returns ALL possible attributes, and only includes values for those that have values. Edited May 18, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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