Forum Discussion

ssv's avatar
ssv
Occasional Contributor
6 years ago
Solved

Test Complete Object Mapping different with different executions

I have a weird problem, where the object i am trying to access changes between the following two.   I have sys.process("msiexec") and sys.process("msiexec", 2), which heaviliy interchanges, when i ...
  • tristaanogre's avatar
    6 years ago

    This is a common problem.  The problem can be summed up as such:

     

    You cannot check the value of the "Exists" property of an object if it doesn't exist.  If you think about it, it makes sense... how can you check ANY property of a non-existant object?

     

    For your situation, I'd look into using "WaitChild" for your check for existance. (https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/waitchild-method.html)

     

    Also, review this topic as it covers this problem in more general terms.

    https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html

  • liquidphantom's avatar
    6 years ago

    You'll need to use an If Not for the first statement

     

    i.e.

    If Not Sys.Process("msiexec", 2).Form("product*").Exists Then
          Set qvProcess = Sys.Process("msiexec").Form("product*")
    ElseIf Sys.Process("msiexec", 2).Form("product*").Exists Then
          Set qvProcess = Sys.Process("msiexec", 2).Form("product*")
    End If

     

    Might have to tweak it a little but the If Not is important so it doesn't get caught in the error.