| || |
yet another .Exist() \"nuance\"
Given my frustration in tracking down "my" problem, "nuance" is a very kind description!
So, I have a .NET aut that is, to say the least, "challenging" in it's behavior. One of the behaviors it has: depending on the navigation through its screens, most of which contain tabs, it will sometimes leave a screen's tabs and controls in the main window, but overlay the new screen on top of the previous (and I suspect that this stacking may be more than two screens deep).
To the human user there is only one screen with its tabs and controls being displayed, but QTP "sees" all currently instantiated in its main window.
Lastly, QTP does not see tabs as part of the object hierarchy, so vitually all of the screen's tabs and controls are simply peer objects who's only parent is the main window.
So, swfName names must be unique, otherwise unpredictable results follow when QTP attempts to interact with this AUT.
Now, down to the problem with .Exist() that I think is worth noting. The following line of code should, and most often does waits up to 20 seconds for the existance of an swfTab object:
But on occasion it returned immediately with a False ("does not exist") status. So how can that be. I looked in the Test Results log for this statement, but all it says is:
"Object does not exist"
So, why did'nt it wait 20 seconds to return that status? Well it took quite a while but I finally got the test to terminate exactly after this "quick", does not exist point. Then I used the Object Spy and asked it to highlight the tab in question--AND it coughed up the answer in it's dialog:
"The test object description is not unique. More than one object in the application matches the description"
Armed with important piece of info I was able to manually replicate the naviation, and the screen prior to the failed .Exist statement both have a tab with the swfName of tabControl1. (So my AUT is apparently leaving the prior screen's tab and controls in the main window, and then overlaying them with new, visible screen and its tabs and controls).
QTP should either be throwing one of its many error exception dialogs when this occurs (and that dialog should contain the exact message from the Spy's dialog), AND/OR (AND as far as I am concerned) placing that same message in the Test Results file when the .Exist() method returns False.
Well anyway, forewarded is forearmed.
-Hope this helps others, Terry Horwath
Re: yet another .Exist() \"nuance\"
Yes. I know that Exist returns False when there are multiple definitions. I guess which is the correct response. At the same time if you define the index:=0 it will always tell you if the object actually exists or not.
Re: yet another .Exist() \"nuance\"
[ QUOTE ]
Yes. I know that Exist returns False when there are multiple definitions. I guess which is the correct response.
[/ QUOTE ]
Well, the QTP developer's agree with you on this response. But the object does in fact exist, so a response of "does not exist" seems very incorrect to me. And the fact that QTP does not then go on to mention, "oh, by the way, there are multiple objects on the screen that have the same definition as the one you are checking", is the real problem here. Much troubleshooting ensues, even when you are lucky enough to visually notice that the wait period was way too short (as here again, QTP does not log how long it waited before it declared that the object did not exist).
But, we can agree to disagree. The important thing is that others on the board have seen this issue discussed.