Jump to content

Recommended Posts

Posted (edited)

Hi!

Does anyone have any idea why Test() returns 0, while Test2() returns 1?

#include <IE.au3>

MsgBox(0, "", Test() & " " & Test2())

Func Test()
    Local $oHTML = ObjCreate("HTMLFILE")

    $oHTML.body.innerHTML = FileRead("Test.html")

    Return IsObj($oHTML.getElementsByClassName("example"))
EndFunc

Func Test2()
    Local $oIE = _IEAttach("", "instance", 1)

    Return IsObj($oIE.document.getElementsByClassName("example"))
EndFunc

Sample Test.html I open in IE before testing:

<!DOCTYPE html>
<html>
    <body>
        <p class="example"></p>
        <div class="example"></div>
    </body>
</html>

I'm receiving html text in a response to http request, I need to parse it fast and easy, getElementsByClassName would have been ideal. I'm using 3.3.12.0 version.

Edited by mjolnirmarkiv

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
×
×
  • Create New...