cancel
Showing results for 
Search instead for 
Did you mean: 

TestComplete v14. FindChild (dynamic) version of an XPath doesn't work in TC v14

New Contributor

TestComplete v14. FindChild (dynamic) version of an XPath doesn't work in TC v14

Hi there,

We are using Test Complete v11 for our automated test cases and we are currently testing Test Complete v14
we came across some XPath we have for mapping application objects in our product are working in TC v11 and they don't work in TC v14

we use in TC v11.31.2420.7 the FindChild (dynamic) version of an XPath, this doesn't work in TC v14

In TC v14 we can only get the test to work using the absolute XPath from Object Spy

For e.g in Test Complete v11 this is the XPath that work

Sys.Process("ImageScope").FindChild("Name", "WPFObject(\"MacrosListView\")", 1000).Child(1)

This XPath doesn't work in Test Complete v14


The Xpath that works in Test Complete v14 is the absolute XPath below


Aliases.ImageScope.HwndSource_PopupRoot.PopupRoot.Decorator.NonLogicalAdornerDecorator.MenuItem.RootGrid.MacrosListView.WPFObject("ListViewItem", "", 1)

I have also tested these XPaths I have created from the absolute XPath and get with the Spy tool and they don't work in v14

Sys.Process("ImageScope").FindChild("Name", "WPFObject(\"ListViewItem\")", 1000)

Sys.Process("ImageScope").FindChild("Name", "WPFObject(\"ListViewItem\")", 1000).Child(1)

Is there anything changed or new in v14 that affect the objects application mapping using the FindChild (dynamic) version of an XPath?

When we use the absolute XPath the test passes with warning message below


<html><style>body {font-family : Segoe UI, Tahoma, Arial, Helvetica, sans-serif; font-size : 10pt; font-weight : normal; padding : 14px 8px 8px 14px; margin : 0 0 0 0;} p {margin : 4px 0 4px 0; padding : 0 0 0 0;} h4 {font-size: 10pt; font-weight : bold; margin : 12px 0 0 16px; padding : 0 0 0 0;} table {margin-left : 16px; border-top: 1px solid grey;} td {font-size : 10pt; font-weight : normal; padding-left : 8px;} </style><body><p></p><p>There are several objects that match the identification attributes of the "<a href="namemapping://{9E92F967-7A95-413A-9BF8-2B4DDAFF72AE}.{F4C414FE-CC07-44D6-8F75-DD05C964FEE5}">HwndSource_PopupRoot</a>" mapped object. This may result in slow search for objects.</p><p style="margin-top: 12px;">To solve the problem, you may need to modify the mapping settings of the "<a href="namemapping://{9E92F967-7A95-413A-9BF8-2B4DDAFF72AE}.{F4C414FE-CC07-44D6-8F75-DD05C964FEE5}">HwndSource_PopupRoot</a>" object or one of its parent objects.</p><p style="margin-top: 12px;"><a href="namemappinghideamb://{9E92F967-7A95-413A-9BF8-2B4DDAFF72AE}.{F4C414FE-CC07-44D6-8F75-DD05C964FEE5}">Disable this warning for the "HwndSource_PopupRoot" mapped object.</a></p><p style="margin-top: 12px;"><a href="aqa-help://2204">See Help for more information</a></p></body></html>



Thanks

3 REPLIES 3
Highlighted
Community Hero

Re: TestComplete v14. FindChild (dynamic) version of an XPath doesn't work in TC v14

OK... so... a couple of things.

1)  Technically speaking, finding by "Name" is not exactly the recommended way of finding an object.  You should be finding based upon a set of properties like ObjectType, ObjectIdentifier.  It's not an "XPath", it's a set of properties.  And, with the "Name" that you're using, as the message indicates, there are more than 1 object that matches what you're looking for.  So... you need to search differently

2) Get rid of the concept of "XPath" for the most part with TestComplete... use "NameMapping" and learn it's usage.  This is going to be, ultimately, more efficient and less error prone

3) TC 14 has had a number of performance improvements in object identification over previouse versions.  It is possible that, in doing so, it's actually corrected some inefficiencies making the "FindChild" that you're using return more objects that intended.

So.... Now that we have that established.... the problem is, generally, that you haven't been specific enough in your search parmeters for the desired object.  You need to use a more specific set of properties.


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: TestComplete v14. FindChild (dynamic) version of an XPath doesn't work in TC v14

So basically if I use the aliases path below to identify the object the test Pass with a warning

 

Aliases.ImageScope.HwndSource_PopupRoot.PopupRoot.Decorator.NonLogicalAdornerDecorator.MenuItem.RootGrid.MacrosListView.WPFObject("ListViewItem", "", 1)

 

I used the FullName path below and the test Pass without any warning, as you said in the Aliases path I haven't been specific enough in the search parmeters for the desired object

 

Sys.Process("ImageScope").WPFObject("HwndSource: PopupRoot", "", 1).WPFObject("PopupRoot", "", 1).WPFObject("Decorator", "", 1).WPFObject("NonLogicalAdornerDecorator", "", 1).WPFObject("MenuItem", "", 1).WPFObject("RootGrid").WPFObject("MacrosListView").WPFObject("ListViewItem", "", 1)

 

Thanks

Community Hero

Re: TestComplete v14. FindChild (dynamic) version of an XPath doesn't work in TC v14

What's the warning?  Because it could be that, in your mapping, you haven't designated a clear enough set of properties to uniquely identify the object, hence a "Ambiguous recognition" warning...  NameMapping is work... it's SUPPOSED to be work... and if you don't spend time with it... you will fail at your work.


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
Top Kudoed Authors