Gaining access to properties of elements on a web page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jbonifacejr

    Gaining access to properties of elements on a web page

    Hello everyone. Very sorry if I am posting in the wrong place.

    I am writing a test harnes that will be required to interact with
    elements on a web page, such as inserting text in a text box. At some
    step in the test I will have to identify the text box using properties
    such as the name or id (which can both be set as attributes) or by the
    innerhtml or outerhtml of the element if the other two "attributes "are
    not set.

    What generally happens is that I grab a collection of all of the
    elements on the page that correspond to a specific type. Then I will
    need to step through each element in the collection and compare its
    properties to predetermined values that are stored in name/value pairs
    in a StringDictionar y. The problem is that I do not always know which
    properties I will be comparing. They are different from case to case.
    I don't see a method for an HTMLAnchorEleme nt or HTMLImgElement
    like .getProperties or anything like that. I do see the individual
    things like .innerHTML, .src, etc.

    When an elements properties do not match what I want, I remove it from
    the collection. In the end, I expect to have in my collection one or
    more elements that match what I want to click on or enter text in,
    etc.

    Does anyone have any suggestions on how I can compare properties of
    elements in the collection to the name/value pairs in my
    StringDictionar y, especially when there are multiple name/value pairs.
Working...