cancel
Showing results for 
Search instead for 
Did you mean: 

ObjectSpy can see content of a property, but debugger doesn't.

New Contributor

ObjectSpy can see content of a property, but debugger doesn't.

I'm trying to read text from a popup below and ObjectSpy sees it like on the screen shot. Then I want to log this text and compare it against something in the next part of the script. It returns nothing when I point to alias.WndCaption, but the spy can see it perfectly, when pointed to that line.

2019-07-08_16-00-53.jpg

2019-07-08_16-01-55.jpg

Any ideas why that might be happening?

7 REPLIES 7
Community Hero

Re: ObjectSpy can see content of a property, but debugger doesn't.

Timing.  The dialog might be in memory of the application but the text is not populated immediately.  So, when the code is running "full speed", the "Static" object may have a blank WndCaption.

 

I would use a WaitProperty method off of the Static object to wait for it to be Visible.  Then, once it's visible, then check the value of that property.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

Re: ObjectSpy can see content of a property, but debugger doesn't.

Thank you for the response. This does not seem to help though... I have the window to be detected open and objectspy does its job and then I'm trying to execute a simple function:

   Aliases.Workstation.popupDialog.Static.WaitProperty("Visible", true, 5000);
   Log.Message(Aliases.Workstation.popupDialog.Static.WndCaption);

Still, it returns nothing, while objectspy sees the popup text properly...

Any other ideas?

Community Hero

Re: ObjectSpy can see content of a property, but debugger doesn't.

IThe way, sometimes, objects are made visible/invisible is that the parent (in this case the popupDialog) may not be visible but the child object is (Visible property set to true).  

Change the first line to do the waitproperty on popupDialog, not on static, and see what happens.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

Re: ObjectSpy can see content of a property, but debugger doesn't.

I did what you recommended, but while TC sees the window no problem, it still returns nothing from the popup text...

This is what the program sees during run/debug, what object spy sees is the same as above.2019-07-15_9-09-11.jpg

 

Community Manager

Re: ObjectSpy can see content of a property, but debugger doesn't.

How about refreshing the object tree before accessing it?

Aliases.Workstation.popupDialog.Refresh()
---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Contributor

Re: ObjectSpy can see content of a property, but debugger doesn't.

Tried doing that and even delaying after the refresh, still the same thing:

2019-07-18_14-14-19.jpg

Community Manager

Re: ObjectSpy can see content of a property, but debugger doesn't.

Thanks for checking this, @_Monika.

That's strange. Could you please contact our Support Team to investigate this behavior? You can contact them here: https://support.smartbear.com/message/?prod=TestComplete

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Top Kudoed Authors