Jump to content

Recommended Posts

Posted (edited)

So I have this small reproducer:

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

Edited 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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...