Forum Discussion
- rraghvaniChampion Level 3
We need more information, as we don't know exactly what you are doing?
- pawan_werulkarOccasional Contributor
I am testing windows application and I have to run regression suit once in a week I get false negative test cases in test suit like "window is disabled" for that I have put the conditions like waitproperty to enabled it, sometime it works sometime does not work also for same I have add delay wait but not able to handle above error properly what is the best way to handle it?
- rraghvaniChampion Level 3
What automation instructions/actions are you performing, against your windows application? and what results are you expecting?
- pawan_werulkarOccasional Contributor
Actions like ClickButton() , keys() for text field() for switching tab clicktab() for dropdown clickItem()
- pawan_werulkarOccasional Contributor
and I am expecting that when performing action on elements sometime I got the error like window is disabled for that I have put the condition e.g. ele.WatProperty("Enabled",True,3000)
- pawan_werulkarOccasional Contributor
what is a best way to handle these errors.
- rraghvaniChampion Level 3
Are you able to provide and describe the exact steps involved, before the error appears? What is the state of the application/dialog? Is there another dialog obscuring the window/dialog you are trying to interact with?
It's impossible to provide suggestions/solutions with the information you have given!
- JDR2500Frequent Contributor
I like to debug those types of problems with a screen capture. That's the only way I can tell what exactly is going wrong. Reviewing the screen captures then I can often refine what I use in the WaitProperty statement to get better results. Below is an example of my approach. Maybe it will help, maybe not. At least you'll be able to see what's happening.
Set wnd = MyApplication.MainWindow If Not wnd.WaitProperty("Enabled",True,5000) Then Log.Warning "The application and/or target window is disabled" Set w = Sys.Desktop.Picture Log.Picture w, "Screen capture showing disabled window" End If
- AlexKarasChampion Level 3
Hi,
Below is an example of my approach.
Actually, unless test code interacts with MyApplication.MainWindow, your sample code will not provide you with any help as it checks the state of MainWindow object only.
Unless you are using latest TestComplete version and something was broken in it, "The window is disabled. [...]" message was always correct and meant that the target window is disabled and end-user cannot interact with it.
You can get the name of the problematic window from Details pane of test log.
Considering, that the problem is intermittent, it might indicate timing issue when your test code proceeds fast enough and target window/UI control that was blocked by, for example, some modal notification window, are not enabled back by system or your application's code.
To resolve the problem: figure out exact window/control that is reported as disabled and then analyze how tested application behaves when it reaches this state and what does your test code. Ideally, it might help if you have an option to talk to developers and they can provide you with description of how windows/controls of your tested application are disabled and enabled for this tested functionality.
- JDR2500Frequent Contributor
I should have clarified it was intended as an example. You would need to substitute the appropriate window identification for "MyApplication.MainWindow".