I have QTPv9.2 with the Java Add-In, and am having trouble with the "select" command, when accessing JavaLists. The command doesn't always work, so I need to make a work-around that I could use in any of my scripts.
Specifically, my Java-based application under test has a JavaList within a JavaWindow that contains 1138 items. I would like to be able to programatically confirm success or failure when accessing a specific item.
I could use analog or low-level recording. But that would mean I would have to make a recording every time I want to select a different object.
I could iterate through the list and compare each item with the one I want to select. But as I have 1138 items in the list it will take too long. And, if the item is not in the list, you'd have to run the entire list, before finding out it's not there.
To date, everything I've done can't programmatically verify the success of my selection (rc = ?). However, I checked the object spy for the object, and there IS a Run-Time method for the JavaList called "getNextMatch(string, int, Position$Bias)". It sounds like it would be the perfect (pardon the pun) match, but I'm having trouble implementing it: