loosing mapped web object
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
loosing mapped web object
Hi,
The parent web object in Name Mapping has prepared declaration:
.class11.class12:not(.class13) > .class21
Similar example css setting there are at first picture here => https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/sele... .
My Keyword Test uses this mapped object in a loop.
It works during first run properly but in the second turn I getting error of unrecognized child object (because above described parent is unrecognized) with the log message below:
Solved! Go to Solution.
- Labels:
-
Keyword Tests
-
Name Mapping
-
Web Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the parent object is changing, then you might need to use Regular Expressions Syntax or Using Wildcards to identify the object.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is Regular Expressions and Wildcards only option in that situation ?
Is it the proper/expected behavior of Test Complete ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regular Expression or Wildcards will most likely resolve the issue.
It's the expected behavour with programming languages that follow object oriented programming
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> The window size is (0, 0);
Knowing no details about your given tested application, this sounds to me like one of the usual problems caused by poor tested application design/implementation.
Scenario been guessed is like this:
-- Your test code gets a reference to the object (A) before entering the loop;
-- Test code does something on the first loop iteration. As a result of this action, object A must be modified within the tested application. But tested application neither modifies object A, nor deletes it from the DOM. Instead, tested application hides object A by setting its width/height to zero and creates a new object (A1) that is identical to initial object A. (Actually, this is a resource leak, because object A remains in DOM and consumes resources but is never used from now on.);
-- Now your test code moves to the second loop iteration and tries to reuse object A. The object still exists, thus its reference remains valid and you do not get 'Object Not Found' error, but action (like .Click() ) over this object is not possible because of its zero size and this causes the message that you see in test log.
Try to investigate tested page in the Object Browser after first loop iteration and check if width/height of initial object A are zeroed indeed. If they are, then search for the sibling object (A1) that is identical to object A but is visible (i.e. has its width/height positive). If you find such object this will mean that my guess is correct.
If my guess is correct, then you have two options:
-- Report resource leak to Development and insist on the fix. To say the truth, I do not believe in this option - who cares about resources nowadays? 😞
-- Your second option is to add additional criterion in NameMapping to make it search for the object of non-zero size and move object search inside the loop, so TestComplete will re-evaluate the reference to the object on every loop iteration and will use correct newly created object (A1, A2, ...) for the actions performed within the loop.
Hope this will help...
/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
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot @AlexKaras for your wide answer - I appreciate.
I can't report this problem to Development. This part source code have been realized by another company and it can't be modify. It works properly and this is my problem - how prepare testing in this environment for modifying part application only.
You see, it's politically complicated. 🙂
For explanation - in HTML code all the parent object declarations (like below) are permanently exists.
<parent1 class = class1 class2 class3 name=... >
<parent1 class = class1 class2 name=... >
...
<parent1 class = class1 class2 class3 name=... >
The name of class3 is "ng-hide" - it may help more explains this specific situation.
But I hope, I found resolving but please, be patient.
I want to indicate my previous insight:
I may change unrecognized status manually by unmark and then mark again mapped declaration. After then, it can (proper) recognize parent mapped object by "Highlight" menu order (and of course child too).
At the beginning, I have prepared other Keyword Test with loop and called a main Keyword Test (without loop). I have hoped - maybe each new calls Keyword Test could find the proper path to object by saved mapping (with pseudo-class):
.class11.class12:not(.class13) > .class21
Unlikely, without success.
And then, I found method RefreshMappingInfo. Now, it still works properly. It's amazing.
Of course, before call child object (in the loop) I call RefreshMappingInfo method on parent object.
I hope, it will be stable resolving. If not, I come back here.
Really thanks for all of you.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great to hear that the problem is solved.
Actually, .RefreshMappingInfo() method is mentioned in the documentation article that you referenced in your initial message 😉
Just as a side note: TestComplete provides a really good, correct and descriptive documentation that definitely worth detailed reading.
/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
================================
