doran_snider
14 years agoNew Contributor
WaitSwingObject not working?
I used the script extension "Wait for Object" I found here, http://blog.smartbear.com/software-quality/bid/170163/, to insert an if statement to wait for an object to appear before proceeding.
I thought the intention of this was to control flow of the playback, as we don't know how long some things take in the application. In my case, it is on loading. I start the app, choose a file to load, then the application takes some amount of time to load to the application's desktop. Because this loading process takes a variable amount of time, I thought this "Wait for Object" script extension, utilizing the WaitSwingObject method would be perfect.
If (Not Aliases.java.wndSunAwtFrame1.RibbonRootPane.null_layeredPane.null_contentPane.ScrollPane.Viewport.ProjectToolDesktopPane.WaitSwingObject("JInternalFrame", -1).Exists) Then
My problem is this statement fails with "object does not exist", completely defeating the purpose of this method in the first place. I know the object doesn't exist yet, the application is still loading; that's why I'm using this method. I want my script to wait an infinite amount of time to let the application finish loading before moving on. I used a timeout of -1 for "infinate", but it still fails within 3 seconds. I increased the method invoke timeout to 50000ms in the project Open Applications->General settings, but this didn't have any affect.
If I don't use this WaitSwingObject method in my if statement, then my script fails on the next step of clicking a dropdown because it can't find the dropdown (because my app hasn't finished loading yet).
The object in my If statement is in my NameMapping and when I use object spy on this object, it does indeed highlight it in my application (of course the application has to finish loading before it "exists").
Also, I used the Wait for Object script extension during recording to say, "wait for this object to exist an infinate amount of time".
Any ideas?
I thought the intention of this was to control flow of the playback, as we don't know how long some things take in the application. In my case, it is on loading. I start the app, choose a file to load, then the application takes some amount of time to load to the application's desktop. Because this loading process takes a variable amount of time, I thought this "Wait for Object" script extension, utilizing the WaitSwingObject method would be perfect.
If (Not Aliases.java.wndSunAwtFrame1.RibbonRootPane.null_layeredPane.null_contentPane.ScrollPane.Viewport.ProjectToolDesktopPane.WaitSwingObject("JInternalFrame", -1).Exists) Then
My problem is this statement fails with "object does not exist", completely defeating the purpose of this method in the first place. I know the object doesn't exist yet, the application is still loading; that's why I'm using this method. I want my script to wait an infinite amount of time to let the application finish loading before moving on. I used a timeout of -1 for "infinate", but it still fails within 3 seconds. I increased the method invoke timeout to 50000ms in the project Open Applications->General settings, but this didn't have any affect.
If I don't use this WaitSwingObject method in my if statement, then my script fails on the next step of clicking a dropdown because it can't find the dropdown (because my app hasn't finished loading yet).
The object in my If statement is in my NameMapping and when I use object spy on this object, it does indeed highlight it in my application (of course the application has to finish loading before it "exists").
Also, I used the Wait for Object script extension during recording to say, "wait for this object to exist an infinate amount of time".
Any ideas?