Reputation: 3884
this only gets the first of the elements, though the backend cgi (such as php) can get all these in an array.
$surl=some url
$ie = new-object -com "InternetExplorer.Application"
$ie.visible = $true
$ie.navigate($surl)
$doc = $ie.Document
$element = $doc.getElementByID("some_name[]")
this only gets the first of the elements with the same name.
i am trying to fill values with a script but so far have not figured out a way to go beyond the first of these elements. i do not control the document rendering so cannot change how these are named.
thanks for any ideas!
Upvotes: 1
Views: 21073
Reputation: 52699
An HTML ID has to be unique! So that's why you only get one.
From: http://www.w3schools.com/tags/att_standard_id.asp
The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).
The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id.
Per the getElementById documentation:
Returns a reference to the first object with the specified value of the ID or NAME attribute.
Use getElementsByClassName or getElementsByName or getElementsByTagName instead.
Upvotes: 2