Adagio
7 years agoFrequent Contributor
A condition in the if statement is causing problem
Hi,
I'm writing a script to test a java client. There's a dialog recognized as an SWTObject.
If the dialog is not present, 'else' block in the following code should be executed, but something else is happening.
if(Aliases.javaw.SWTObject("Shell", "Primary : *").Exists){ Log.Message("Dialog found"); }else{ Log.Message("Dialog not found"); }
Here, if the object is present on the app, then it just works fine, but if the SWTObject is not present it throws this error instead of executing the 'else' block.
Unable to find the object SWTObject("Shell", "Primary : *"). See Additional Information for details.
I don't understand this behaviour. Could someone please help?
Thank you
Abhi
The exists method could be used if the object is mapped though, or using WaitProperty.
Hi Abhi,
Replace SWTObject() call in your code with WaitSWTObject() one.