Forum Discussion

pabramowitsch's avatar
pabramowitsch
Occasional Contributor
15 years ago

Playback very erratic on desktop application

My problem is similar to some others that have mentioned it relative to their web testing, but mine is a java swing application.   When I playback a script often it repeatedly fails to recognize the very first window.  Other times it will run without any problem.  It is unrelated to what other applications are running on my system.   The object browser shows the first window with exactly the same name and path (in my name map) as it is referred to in the script.   Installing TC and tested app on another computer shows the same problem.  The way I wait for the window to be ready after launching the application is this:



function WaitForDesigner()

{

      Sys["Process"]("java")["SwingObject"]["WaitChild"]("EditModalDialog", 30000)

}



Funny thing is is that it doesn't wait for 30 seconds, instead it waits 0 time and then moves ahead into the script reporting object after object not found.  Other days it is fine.   This is seriously disturbing our work with the product.   



- P




  • Hi Peter,





    Your routine should not work properly - the code line is incorrect. I recommend that you see the "WaitChild Method" and "SwingObject Method" help topics - they explain how to use this methods in the correct way.





    To accomplish your task, I suggest that you try using the modified routine:





    function WaitForDesigner()

    {

      Sys["Process"]("java")["WaitChild"]("*EditModalDialog*", 30000);

    }





    Passing "EditModalDialog" as the first parameter to the WaitChild method in your routine should not be sufficient for obtaining the object you expect. You need to pass the value of the needed object's Name property that can be found out from the [url= http://www.automatedqa.com/support/viewarticle/?aid=2541]Object Browser[/url]. Since I do not know the exact value of this property, I used the "*" wildcards - the WaitChild method will return the object containing "EditModalDialog" in the value of its Name property.





    BTW, I recommend that you use JScript instead of C#Script unless you are going to create C# Connected or Self-Testing applications. The JScript syntax is more intuitive, and the functionality of the two languages is equal. Also, note that C#Script scripts can be launched in JScript projects and vice versa. The same applies to C++Script. Please see the "[url= http://www.automatedqa.com/support/viewarticle/?aid=8241]Selecting the Scripting Language[/url]" help topic for more information.