views:

80

answers:

1

[The description is a bit fudged to obfuscate my real work for confidentiality reasons]

I'm working on a QTP test for a web page where there are multiple HTML tables of items. Items that are available have a clickable item#, while those that aren't active have an item# as plain text.

So if I have a set of ChildObjects like this:

//This is the set of table rows that contain item numbers, active or not.
objItemRows = Browser("browserX").Page("pageY").ChildObjects("class:=ItemRow") 

What is the simplest way in QTP land to select only the clickable link-ized item #s?

UPDATE: The point here isn't to select the rows themselves, it's to select only the rows that have items in them (as opposed to header/footer rows in each table). If I understand this correctly, I could then use objItemRows.Count to count how many items (available and unavailable) there are. Could I then use something like

desItemLink = Description.Create
   desItemLink("micclass").value = "Link"
objItemLinks = objItemRows.ChildObjects(desItemLink)

To get the links within only the item rows?

Hope that clarifies things, and thanks for the help.

A: 

I think I have this figured out.

Set desItemLink = description.create
    desItemLink("micclass").value = "Link"
    desItemLink("text").RegularExpression = True
//True, Regex isn't really required in this example, but I just wanted to show it could be used this way
//This next part depends on the format of the item numbers, in my case, it's [0-9]0000[0-9]00[0-9]

For x = 0 to 9
  For y = 0 to 9
    For z = 0 to 9
      strItemLink = x & "0000" & y & "00" & z
      desItemLink("text").value = strItemLink
      Set objItemLink = Browser("browser").Page("page").Link(desItemLink)
      If objItemLink.Exist(0) Then
         //Do stuff
      End If
    Next
  Next
Next

Thanks for your help anyways, but the code above will iterate through links with names in a given incrementing format.

Riddari