Forum Discussion
Can you post the code? What code language are you using? A bit more information as to what this looks like will help out.
- sree20117 years agoContributor
I am using Vb Script for scripting. Following is one of the sub which we are using
Sub TestSub(engName,Ftype)
If Sys.Process("*").WPFObject("HwndSource: DesignerHost").Exists Then
Sys.Process("*").WPFObject("HwndSource: DesignerHost").Close
End if
BuiltIn.Delay(4000)
If Sys.Process("eAudIT").WPFObject("HwndSource: eAudITMessageBox", "").Exists Then
Set msgBox = Sys.Process("eAudIT").WPFObject("HwndSource: eAudITMessageBox", "").FindChild(Array("Name","Visible"),Array("WPFObject(""btnYes"")", True),10)
If msgBox.Exists Then
Call msgBox.Click
End If
End If
Engagement="Engagement:"+engName
Builtin.Delay (2000)
End SubHere in the first If condition if the object does not exists, it will have the mentioned error in Err. Description and it will come out of the Sub without going to the remaining code. Please let me know if you require any further information.
- tristaanogre7 years agoEsteemed Contributor
Actually, this line of code is problematic...
Sys.Process("*").WPFObject("HwndSource: DesignerHost").Exists
If the object does not exist... how can you check the "Exists" property of a non-existent object? This is improper code. In the recent versions of TC, this is being enforced a bit more strictly. A proper code for checking this condition would be
Sys.Process("*").WaitWPFObject("HwndSource: DesignerHost", -1).Exists
The WaitWPFObject method will wait for the object to resolve... if it doesn't within the designated time out, it returns a "stub" object with an Exists property set to false. This is the best practice for checking for object existance, using a "WaitNNN" method.
See
https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/waitwpfobject-method.html- AlexKaras7 years agoChampion Level 3
> A proper code for checking this condition would be
Sys.Process("*").WaitWPFObject("HwndSource: DesignerHost", -1).Exists
I think that it should be:
Sys.Process("*").WaitWPFObject("HwndSource: DesignerHost", 0).Exists
As per documentation, timeout that equals to -1 will wait forever, while if timeout is zero, than no wait will occur, just a check of whether or not the sought for object exists.
Everything else said by Robert is perfectly correct.