PetGin's avatar
Occasional Contributor
2 months ago
New Idea

NameMapping: Add "AND" clause to xpaths for element identification

NameMapping: Add "AND" clause which would require two or more unique xpaths to be true for the element to be identified. 

We would like the ability to use an "AND" clause which would require two or more unique xpaths to be true for the element to be identified. The reasons for this area as follows:

We have had limited success using the “AND” condition within an xpath statement. We have had numerous cases where the expression is syntactically correct and confirmed by TestComplete in the NameMapping Annotation but it fails to find the specified text within the node/object. In other cases, it finds the desired object (viewGroup w/ text) but fails a property checkpoint using a cmpContains (text), returning a null string even thought the NamedMapping found the object based on that defined text. 

xpath: //*[@className='android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup' and @text="SR Zone Controller"]
xpath: //*[@className='android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup' and contains(@text,'SR Zone Controller')]

The second and more concerning issue is the case where an object is discovered using a combined expression as shown below that correctly locates the object viewGroup which contains some specific text but fails a checkPoint operation.

xpath: //android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[*[@text="SR Zone Controller"]]

We have had some success finding element using "FindElementByXPath, but this method is much more involved and difficult to implement. It would be so much easier for the user if an “AND” clause was added to the NameMapping XPATH statement as an enhancement to the “OR” clause.

Note: We are working with a Mobile App and don't have the luxury of ObjectIDs or CSS for object identification.  


No CommentsBe the first to comment