is this black magic or a bug? - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: is this black magic or a bug? (/Thread-is-this-black-magic-or-a-bug) |
is this black magic or a bug? - ConstantChange - 04-11-2008 Hi all! How is this possible: When I run the following code: Code: Set desc=Description.Create 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 Now, found.count returns 0. How is that possible, according to this: https://www.learnqtp.com/descriptive-programming-simplified/ the "index" property is totally valid!? Why doesnt it work for me? Thanks very much in advance! Cheers, CC RE: is this black magic or a bug? - ConstantChange - 04-18-2008 bump - sorry, I really need help on this! Thanks! RE: is this black magic or a bug? - Ankur - 04-18-2008 Using Object Spy, what does index contain? RE: is this black magic or a bug? - FredMan - 04-23-2008 Try desc("index:=0") RE: is this black magic or a bug? - ConstantChange - 05-02-2008 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!! RE: is this black magic or a bug? - Anshoo Arora - 05-10-2008 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? |