Thanks Sreedhar. I got similar information on another message board.
What this code does is grab all of the objects on a web page that are
links, then filters it further to only grab certain links that meet
the criteria of "height" = 17 and 22. (you can use whatever filters
you want. Use the object properties as filter types.)
Then it gathers the "innertext" name of these filtered links.
These link names are then gathered in a dynamic array.
Here is the code that I am going to go with and it does work the way I
need it to:
---------------------------------------------
Dim LinksArray()
Dim y
Set Links = Description.Create()
Links("micclass").Value = "Link"
Links("height").Value = 17
'Collection of links with height=17
Set TotalLinks_H17 = Browser("Home").Page("Home").ChildObjects(Links)
Links("height").Value = 22
'Collection of links with height=22
Set TotalLinks_H22 = Browser("Home").Page("Home").ChildObjects(Links)
'To get the counts:
intCount_H17 = TotalLinks_H17.Count
intCount_H22 = TotalLinks_H22.Count
intTotalCount = TotalLinks_H17.Count + TotalLinks_H22.Count
For i = 0 to intTotalCount - 1
ReDim Preserve LinksArray(intTotalCount - 1)
y = 0
'Grab innertext of current link
For x = 0 to intCount_H17-1
LinksArray(y) = TotalLinks_H17(x).GetRoProperty("innertext")
y = y + 1
next
For x = 0 to intCount_H22-1
LinksArray(y) = TotalLinks_H22(x).GetRoProperty("innertext")
y = y + 1
next
next
msgbox intTotalCount
--------------------------------------------
Thanks again for all the help. I hope someone may be able to use this.
Steve
On Aug 4, 1:50 pm, Sreedhar Mallipeddi <[email protected]> wrote:
> try this out
>
> Dim Links
> Set Links = Description.Create()
> Links("micclass").Value = "Link"
> Links("height").Value = 17
> Set TotalLinks = Browser("Home").Page("Home").ChildObjects(Links)
>
> Links("height").Value = 22
> Set TotalLinks = Browser("Home").Page("Home").ChildObjects(Links)
>
>
>
>
>
> On Tue, Aug 4, 2009 at 8:31 PM, Steve <[email protected]> wrote:
>
> > Here is my code so far:
>
> > ----------------------------------------------
>
> > Dim Links
>
> > Set Links = Description.Create()
> > Links("micclass").Value = "Link"
> > Links("height").Value = 17
> > Links("height").Value = 22
>
> > Set TotalLinks = Browser("Home").Page("Home").ChildObjects(Links)
>
> > ---------------------------------------------
>
> > But after Links("height").Value = 17 is ran the value of Links
> > ("height").Value = 22 replaces it.
>
> > I tried using [1-2][2-7] but that throws an error. Please note, I do
> > want numbers 17 and 22, but I do not want numbers 14 and 15.
>
> > I then tried:
>
> > --------------------------------------------
>
> > Dim Links
>
> > Set Links = Description.Create()
> > Links("micclass").Value = "Link"
> > Links("class").Value <> "toolbarLink"
>
> > Set TotalLinks = Browser("Home").Page("Home").ChildObjects(Links)
>
> > ---------------------------------------------
>
> > Because I don't want the property "class" value to equal
> > "toolbarLink", but that also threw an error. The property "class"
> > value I do want is both "wpsNavItem wpsNavLevel1" and " ", which is a
> > blank.
>
> > Can anyone help me with this?
>
> > Thanks,
> > Steve
>
> --
> Mallipeddi Sreedhar
> 91-9000994721- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---