CSS selector into namemapping
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CSS selector into namemapping
Hello,
I have not been busy with Testcomplete for a long time and I mainly use Keyword tests because I am not a developer. I cannot write code. Now the developers have made an adjustment so that all my tests suddenly fail. This is because I did not set up my namemapping sufficiently uniquely. My colleagues mainly use the CSS selector to give elements a unique ID. They also want me to use it. To what extent is it possible to include the CSS selector in my name mapping? And if that is not possible, what should the developers do so that I can make elements unique enough?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am not sure that CSS selector can be used for Namemepping. (Though you can use the value of the 'class' property as one of the identification criterion for Namemapping.)
The best thing that your developers can do to improve testability of their application is to introduce stable and unique IDs for every UI element that automated test needs to interact with.
/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
Thanks Alex!
@RegasQA does this approach work for you? Please let us know
Sonya Mihaljova
Community and Education Specialist
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Marked solution is incorrect.
This is a recent feature added in TestComplete v14.50 as I was investigating the use of this. There is a full guide on this which can be found on the support site below.
Note - I have tried to implement mapping with CSS selectors alongside my existing name mapping which uses attributes and have had inconsistent mapping results.
For example I map a new object, which on the UI is within an existing mapped object and TestComplete maps it correctly as I would expect within the existing object at alias level, but not anywhere close to where I would expect at the mapped object level.
I contacted SmartBear about this, their suggestion? Delete all my existing mapping and start again if I want to work with CSS locators, hardly a solution, so just be aware of this if you do decide to go down the CSS locator route.
I would suggest if the above is something you would like to do, then up vote the feature request below which would allow us to transition our existing mappings over, rather than deleting and mapping all over again.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> Marked solution is incorrect.
Reply was correct as of date of writing.
> Delete all my existing mapping and start again if I want to work with CSS locators
This is just because the new cross-platform web mode that you are talking about uses Selenium under the hood. Selenium has no idea about TestComplete's native recognition functionality and thus 'native' and 'cross-platform' NameMappings are incompatible and cannot be mixed.
P.S. Search by CSS is supported in TestComplete via the .FindElement() and .QuerySelectorAll() methods and has the same problems as the search by XPath.
/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
@AlexKaras - apologies, I'm from the UK, saw the date as 2nd September 2020, rather than what it is (US date) 9th February 2020.
Still would be nice to see a future update which made the CSS/Xpath locators visible in the old way of mapping so that they could be gracefully switched over. In the software I'm automating it would potentially be worth switching due to the lack of attributes associated to objects, though in recent update of our technologies it seems that they are starting to get better.
