"Waiting for Button Object" occurs AFTER the button has already been pressed for a Java Swing app
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Waiting for Button Object" occurs AFTER the button has already been pressed for a Java Swing app
Greetings,
I have a keyword test for a Java Swing application that is working perfectly fine. However, I am noticing behavior that I don't understand that I believe is making the execution time of the test unnecessarily long. There are several dialog boxes that pop-up in the app during test execution. When I am done interacting with the dialogs, I am closing them by doing a ClickButton operation on the "Close" buttons on each dialog. These buttons are javax.swing.JButtons. TestComplete is correctly clicking on the buttons and the dialogs are dismissed, but then, strangely, I can see in the "indicator" a message like, "Waiting for [Button] Object" and the test paused for several seconds. Normally, I am used to seeing such pauses BEFORE interacting with components. Anyway, I feel like, when you add up all the times that this happens in my test, it is costing me about half a minute (in a test that runs in three minutes). Does anyone have any answers for why this is happening, or what I can do to prevent it from happening so that I can reduce my test execution time?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lets see your code with the ClickButton and a few lines before and after.
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's a keyword test. Do you want me to generate code from it? Or just take a screenshot?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Screenshot is fine!
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Screenshot attached. I will also just paste in the related code that was generated.
Aliases.jp2launcher.SecondExemptBankBandsDialog.RootPane.null_layeredPane.null_contentPane.SplitPane.ScrollPane.Viewport.Panel.ExemptSecondBankBands5MaxHours.SetText(ExemptSecondBankBand5MaxHours); Aliases.jp2launcher.SecondExemptBankBandsDialog.RootPane.null_layeredPane.null_contentPane.SplitPane.ScrollPane.Viewport.Panel.ExemptSecondBankBands6RangeBegin.SetText(ExemptSecondBankBand6RangeBegin); Aliases.jp2launcher.SecondExemptBankBandsDialog.RootPane.null_layeredPane.null_contentPane.SplitPane.ScrollPane.Viewport.Panel.ExemptSecondBankBands6RangeEnd.SetText(ExemptSecondBankBand6RangeEnd); Aliases.jp2launcher.SecondExemptBankBandsDialog.RootPane.null_layeredPane.null_contentPane.SplitPane.ScrollPane.Viewport.Panel.ExemptSecondBankBands6HoursToAccrue.SetText(ExemptSecondBankBand6HoursToAccrue); Aliases.jp2launcher.SecondExemptBankBandsDialog.RootPane.null_layeredPane.null_contentPane.SplitPane.ScrollPane.Viewport.Panel.ExemptSecondBankBands6MaxHours.SetText(ExemptSecondBankBand6MaxHours); Aliases.jp2launcher.SecondExemptBankBandsDialog.RootPane.null_layeredPane.null_contentPane.SplitPane.Panel.ExemptSecondBankBandsConfirmButton.ClickButton(); //Switch to the Non-Exempt General Options tab. Aliases.jp2launcher.TemplateImportDialog.RootPane.null_layeredPane.null_contentPane.Panel.TabbedPane4.ClickTab("Non-Exempt General Options"); //Populate parameters on the Non-Exempt General Options tab. Aliases.jp2launcher.TemplateImportDialog.RootPane.null_layeredPane.null_contentPane.Panel.TabbedPane5.ScrollPane.Viewport.Panel.NonExemptTimesheetSubmittalRemindersComboBox.ClickItem(NonExemptEEtimesheetSubmittalReminder); Aliases.jp2launcher.TemplateImportDialog.RootPane.null_layeredPane.null_contentPane.Panel.TabbedPane5.ScrollPane.Viewport.Panel.NonExemptElapsedHoursIncrementTextField.SetText(NonExemptElapsedHrsIncrement); Aliases.jp2launcher.TemplateImportDialog.RootPane.null_layeredPane.null_contentPane.Panel.TabbedPane5.ScrollPane.Viewport.Panel.NonExemptGraceTextField.SetText(NonExemptGrace);
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have seen this exact behavior in JavaFX before, but not swing. Same type of thing, I have dialog popup that occurs and need to dismiss with the click of a button. The clickButton works and then it waits for the button after the click.
I worked around by caching the current time out settings, setting it to 500 then setting it back.
let tempTime = Options.Run.Timeout; try { buttonOK.WaitProperty("Exist",true,5000); buttonOK.WaitProperty("VisibleOnScreen",true,5000); Options.Run.Timeout = 500; buttonOK.ClickButton(); } catch(err) { Log.Error("There was an error with the operations. See Additional Information.", err.message + "\n" + err.stack); } finally { Options.Run.Timeout = tempTime; }
Hacky solution but it works.
Thanks,
Carson
Click the Accept as Solution button if my answer has helped
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the suggestion! I was hoping for a solution that didn't involve any coding, though. Like I said, the test runs fine. It is just taking longer than it has to because of the unnecessary waits.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That solution could definitely be replicated in keyword test. I would recommend opening a support ticket as well though. Something I probable should have done.
Thanks,
Carson
Click the Accept as Solution button if my answer has helped
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks again. I just might do that (open a support ticket). Could you give me an idea of how to implement your solution in a keyword test? For example what operation would I use to grab the timeout setting?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I entered a support ticket for this, but I assume no one else but me can access the ticket, so I won't post the ticket # here.
