Search code examples
autoit

How to get an html element by tagtype in autoit


In an autoit script I'm looping through all elements with

For $oElement in $oFormElements

and I can identify an element by it's html type attribute. i.e.:

<input type="password .... />

equals:

If $oElement.Type = 'password' Then

So far so god, but can I select an HTML object not by it's type attribute but instead by it's tag type i.e. "button"

<button id="Test>Test</>

I can't find a reference in the autoit wiki that tells me what properties a DOM object can have.


Solution

  • Use _IETagNameGetCollection

    #include <IE.au3>
    Local $oIE = _IECreate("https://google.com")
    Local $oButtons = _IETagNameGetCollection($oIE, "button")
    For $oButton In $oButtons
        Consolewrite("name: " & $oButton.name & " value: " & $oButton.value & @CRLF)
    Next