cancel
Showing results for 
Search instead for 
Did you mean: 

Object sometimes doesn't support Exists

SOLVED
Highlighted
Regular Contributor

Object sometimes doesn't support Exists

had similar problems as described in

https://community.smartbear.com/t5/TestComplete-Desktop-Testing/Object-sometimes-doesn-t-support-Exi...

 

In my case, not only the .Exists property of alias objects was affected, but also .Exists, .Child, .ChildCount, .MappedName, .Parent properties of normal controls. I use alias objects only to identify dialogs, then navigate down the hierarchy..

 

The workaround is to access the control's .FullName property before accessing anything else.

So: for alias objects, call .refreshMappingInfo(), for controls get .FullName.

 

I'm still using TC11.30..

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Object sometimes doesn't support Exists

Thank you for trying to help, Marsha, Alex!

 

Hi @Manfred_F ! I am sorry to hear that you keep facing this. Perhaps the Support team will be able to investigate this deeper? I would suggest opening a ticket like Marsha said since it looks like none of the suggested approaches here helped. 

And, of course, I will really appreciate it if you post the final solution to this thread when you get it. Thank you.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

8 REPLIES 8
Highlighted
Community Hero

Re: Object sometimes doesn't support Exists

Does it work properly if you step through the code with Debug?  If so, there's a timing issue to hunt down.

Highlighted
Community Hero

Re: Object sometimes doesn't support Exists

Hi,

 

I am guessing that you are working with the desktop application, aren't you?

How the reference to the object was obtained?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Regular Contributor

Re: Object sometimes doesn't support Exists

Yes, I work with the desktop application.

The references are obtained as follows:

1) use alias to access the dialog

2) use child, children etc to step down the hierarchy.

 

The effect showed up from within script extensions and from native vb code also. The effect reproducibly occurred at specific locations in my scripts and did not occur at many others.

I'm quite sure that it is not a timing issue.

 

Regards,

Manfred

Highlighted
Community Hero

Re: Object sometimes doesn't support Exists

Hi,

 

This is weird... For desktop applications, object that is accessed via Aliases and .Child() calls must always contain .Exists property.

The only case when this may not happen is when test code references an object through the 'chain' of its parents and some object within this 'chain' does not exist.

E.g. if for the Aliases.App.MainForm.Subform.UserNameTextBox.Exists line of code the Subform object does not exist (or any intermediate object that exists in NameMapping but is excluded from the Aliases tree), then UserNameTextBox may not contain .Exists property.

But for this case I would expect an error in the test log stating that Subform object was not found.

May the above be your case?

Can you provide a code sample that illustrates the problem that you have?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Regular Contributor

Re: Object sometimes doesn't support Exists

Hi,

my impressionis, that problem with .exists property happen for alias objects, whereas controls sometimes have problems with .Child, .ChildCount, .MappedName, .Parent properties: I get a vb runtime error in this case.

As saíd before, when I read .Fullname before, no error shows up.

 

I hope you understand that I can not invest much more time into this case, as it took me 3 weeks to fix this mess, and I should have done other work in this time..

 

Regards,

Manfred

Highlighted
Community Hero

Re: Object sometimes doesn't support Exists

@Manfred_F   What you need to understand is that most of us answering questions on here are volunteers and we are taking our own time to answer questions when we could be working on other things as well.  If you don't want to work on this any more, that's up to you.  You also have the option to contact Support directly.  Here's the link. https://support.smartbear.com/message/?prod=TestComplete

Highlighted
Community Manager

Re: Object sometimes doesn't support Exists

Thank you for trying to help, Marsha, Alex!

 

Hi @Manfred_F ! I am sorry to hear that you keep facing this. Perhaps the Support team will be able to investigate this deeper? I would suggest opening a ticket like Marsha said since it looks like none of the suggested approaches here helped. 

And, of course, I will really appreciate it if you post the final solution to this thread when you get it. Thank you.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Highlighted
Regular Contributor

Re: Object sometimes doesn't support Exists

well, after all I found a solution myself, as posted in the original message.

My intention was just to inform people ..

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors