Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is this black magic or a bug?
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi all!

How is this possible:
When I run the following code:

Code:
Set desc=Description.Create
desc("href").value=".*/displayAuction\.do\?auctionId.*"
desc("html tag").value="A"
found=Browser("Browser").Page("GeneralApplication").ChildObjects(desc)


outputting found.count will pop up 32 on a certain page (meaning it has found 32 objects that match)

Now, if I add this line: desc("index").value="0" (or 1), so the code is this:


Code:
Set desc=Description.Create
desc("href").value=".*/displayAuction\.do\?auctionId.*"
desc("html tag").value="A"
desc("index").value="0"
found=Browser("Browser").Page("GeneralApplication").ChildObjects(desc)


Now, found.count returns 0. How is that possible, according to this:
https://www.learnqtp.com/descriptive-pro...implified/

the "index" property is totally valid!? Why doesnt it work for me?


Thanks very much in advance!
Cheers,
CC
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
bump - sorry, I really need help on this! Thanks!
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Using Object Spy, what does index contain?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
Try desc("index:=0")
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
Thanks Ankur and FredMan!

@Ankur: Index contained 0 to 31, depending on which of the links I choose to look at.
@FredMan: Thanks, will try soon!

Cheers!!
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
Well, you use ChildObjects method to retrieve a collection. If you use Index, which only "one" object can have in its specified class, how will this method retrieve the object collection. Thus, it returns 0. You use ChildObjects to find the correct object that you are looking for. If you already know what object you want, then you can simply use Index. Why go through the trouble of using ChildObjects in the first place?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Regarding the bug when i select weedit ,webbutton,link siri 3 3,113 03-17-2008, 04:19 PM
Last Post: siri

Forum Jump:


Users browsing this thread: 1 Guest(s)