I’m working with TestComplete and trying to use Name Mapping to identify multiple web elements that match a given selector. However, when I paste a selector that finds multiple elements in the Name Mapping object, TestComplete only identifies the first match.
Is there a way to configure Name Mapping so that it can recognize and interact with all matching elements, rather than just the first one? Or do I need to use other functions like FindElements to find the elements I need?
When locating the object, TestComplete will go through the specified selectors one after another in the order the Name Mapping editor lists them until it finds an object that matches the selector or until there are no more selectors left.
Originally posted by Hassan_Ballan on January 31, 2025
Can you provide a detailed example to properly understand your issue/goal? can you provide a link to w3shools example page?
It is a given that you interact with the single matching element. From all the matching elements, what qualify the one you are interested in interacting with to single it out?
Originally posted by scottroutesmart on January 31, 2025
You would probably be better off using a function like FindElements() to identify the matching objects. The result is an array of those objects so you can then get the length to know how many matches exist, or get the individual objects and iterate through them.
Be sure to use the plural findelements() instead of the singular findelement() which will only return the first match.