Forum Discussion
sastowe
14 years agoSuper Contributor
I have experienced several things that can cause this:
- The object does not exist YET at the time the line of script gets to it. You need to wait for it.
set frmSave = Sys.Process("MyPrc").WaitVBObject("frMain", 2000)
Then test for existence of frmSave. So let us say that a button click is
issued. And the application under test needs time to load the expected
form. You are telling test complete to wait for the object.
- There are several objects of the same name. We have this ALL over our
application under test. You need to seek the corrrect object that
contanis the sub objects that you need.
So at record time, I might get
Sys.process("MyProc"). a whole bunch of ancillary stuff.VBObject("XTPDockingPaneTabbedContainer").VBObject("btnOk").
Looking in the object browser, I will see many instances of
XTPDockingPanTabbedContainer. So at playback time, which one did it get?
Apparently not the one that contains the btnOK VBObject!
I would do (this is psydo code not intended ti run as is)
asobj =
Sys.process("MyProc"). a whole bunch of ancillary stuff.FinaAllChildren("WndClass", "XTPDockingPaneTabbedContainer") ' it is coincidental in my case that the object is named by the name of the class.
For i = 0 to UBound(asobj)
If asobj(i).WaitVBObject("btnOk").Exists then
set myobject = asobj(i).VBObject("btnOk")
end if
Next
I don't know if either of these conditions is what you are experiencing. But that is what I have seen.
- The object does not exist YET at the time the line of script gets to it. You need to wait for it.
set frmSave = Sys.Process("MyPrc").WaitVBObject("frMain", 2000)
Then test for existence of frmSave. So let us say that a button click is
issued. And the application under test needs time to load the expected
form. You are telling test complete to wait for the object.
- There are several objects of the same name. We have this ALL over our
application under test. You need to seek the corrrect object that
contanis the sub objects that you need.
So at record time, I might get
Sys.process("MyProc"). a whole bunch of ancillary stuff.VBObject("XTPDockingPaneTabbedContainer").VBObject("btnOk").
Looking in the object browser, I will see many instances of
XTPDockingPanTabbedContainer. So at playback time, which one did it get?
Apparently not the one that contains the btnOK VBObject!
I would do (this is psydo code not intended ti run as is)
asobj =
Sys.process("MyProc"). a whole bunch of ancillary stuff.FinaAllChildren("WndClass", "XTPDockingPaneTabbedContainer") ' it is coincidental in my case that the object is named by the name of the class.
For i = 0 to UBound(asobj)
If asobj(i).WaitVBObject("btnOk").Exists then
set myobject = asobj(i).VBObject("btnOk")
end if
Next
I don't know if either of these conditions is what you are experiencing. But that is what I have seen.