Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is this black magic or a bug?
#1
Solved: 10 Years, 9 Months 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: 10 Years, 9 Months ago
bump - sorry, I really need help on this! Thanks!
Reply
#3
Solved: 10 Years, 9 Months ago
Using Object Spy, what does index contain?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#4
Solved: 10 Years, 9 Months ago
Try desc("index:=0")
Reply
#5
Solved: 10 Years, 9 Months 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: 10 Years, 9 Months 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 2,848 03-17-2008, 04:19 PM
Last Post: siri

Forum Jump:


Users browsing this thread: 2 Guest(s)