Jump to content

_IETagNameGetCollection index question


Recommended Posts

Is the index suppose to return the position/instance of the tag I'm looking for? Ex. if I want the innertext of the 2nd "h2" that appears in the web page aren't I suppose to do:

$oElements = _IETagNameGetCollection ($oIE, "h2", 2)

        For $oElement In $oElements
            ConsoleWrite( "!=String: " & $oElement.innertext & @CRLF & @CRLF)
        Next

When I take away the 2 in the getcollection, it returns all the innertext from all of the h2s.

Or am I misunderstanding the index parameter?

Link to comment
Share on other sites

  • Moderators

It's zero based.

_IETagNameGetCollection ($oIE, "h2", 1)

Would return the 2nd index.

Edit:

Example:

#include <IE.au3>
$oIE = _IE_Example ("form")
$oInputs = _IETagNameGetCollection ($oIE, "input", 1)
MsgBox(0, "Form Input Type", "Form: " & $oInputs.form.name & " Type: " & $oInputs.type)
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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