Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

[solved] Grabbing Attribute values

$
0
0
So I have this small reproducer:

[ autoit ]      
#include <IE.au3> $oIE = _IECreate ("about:blank") _IEBodyWriteHTML($oIE, '<div class="yui-dt-message" style="display: none;">text</div>') ConsoleWrite (@CRLF & _IEBodyReadHTML($oIE) & @CRLF) $dom = $oIE.document $oCol = $dom.getElementsByTagName('div') For $oElem in $oCol $oAttributes = $oElem.attributes For $oAttribute In $oAttributes If $oAttribute.name ="class" or $oAttribute.name ="style" Then ConsoleWrite ($oAttribute.name & " " & $oAttribute.value & @CRLF) EndIf Next ConsoleWrite ("getattribute(style)=" & $oElem.getAttribute("style") & @CRLF) ConsoleWrite ("getattribute(class)=" & $oElem.getAttribute("class") & @CRLF) $test = $oElem.getAttributeNode("style") ConsoleWrite ("getattributeNode(style).value=" & $test.value & @CRLF) $test = $oElem.getAttributeNode("class") ConsoleWrite ("getattributeNode(class).value=" & $test.value & @CRLF) Next

the output is:
<DIV style="DISPLAY: none" class=yui-dt-message>text</DIV>
style null
class yui-dt-message
getattribute(style)=
getattribute(class)=
getattributeNode(style).value=null
getattributeNode(class).value=yui-dt-message

I'm not able to grab the style using any methods that i know of...looping through all attributes, .getattribute, .getattributenode().value

and if you notice, the 'class' value isn't returned on the .getattribute.

Any ideas why? (I know this is not the best forum)

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>