Object sometimes doesn't support Exists
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Object sometimes doesn't support Exists
had similar problems as described in
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..
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does it work properly if you step through the code with Debug? If so, there's a timing issue to hunt down.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am guessing that you are working with the desktop application, aren't you?
How the reference to the object was obtained?
/Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
/Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
well, after all I found a solution myself, as posted in the original message.
My intention was just to inform people ..
