Ask a Question

"Waiting for Button Object" occurs AFTER the button has already been pressed for a Java Swing app

SOLVED
saguirre
Occasional Contributor

"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?

1 ACCEPTED SOLUTION

Accepted Solutions
saguirre
Occasional Contributor

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

OK, so SmartBear did find me a solution that worked fine. It was actually a bug in TestComplete, and they provided me with a patch that fixed the behavior. After applying the patch, TestComplete not longer "waits" for buttons it already clicked. It shaved off quite a bit of execution time from my test. The patch they gave me was not in that recent big update, but they assured me that the fix will be in a future release.

View solution in original post

11 REPLIES 11
Marsha_R
Community Hero

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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
saguirre
Occasional Contributor

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

It's a keyword test. Do you want me to generate code from it? Or just take a screenshot?

Marsha_R
Community Hero

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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
saguirre
Occasional Contributor

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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);
cunderw
Community Hero

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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
saguirre
Occasional Contributor

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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.

cunderw
Community Hero

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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
saguirre
Occasional Contributor

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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?

saguirre
Occasional Contributor

Re: "Waiting for Button Object" occurs AFTER the button has already been pressed for a Jav

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.

cancel
Showing results for 
Search instead for 
Did you mean: