[Feature] A special locator to visually locate an element
See original GitHub issueLet us know what functionality you’d like to see in Playwright and what is your use case. A special locator to visually locate an element.
In taiko, browser automation library by thoughtwork, you could locate element visually like the following:
click(checkbox(near("Username")))
Taiko calls it proximity locator Refer: https://docs.taiko.dev/#smart-selectors
This locator will reduce the flakiness of the script and the maintenance cost because the locator doesn’t rely on html structure that may be changed from time to time. Even we can assign data-testid attribute but this is very useful in some cases as well.
Do you think others might benefit from this as well? Yes, it is.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:18 (7 by maintainers)
Top Results From Across the Web
How to locate an element on the page - Web Performance
An element locator, usually referred to as simply a locator, is a method for finding an element on a page. There are many...
Read more >Locators In Selenium WebDriver With Examples
This blog deep dives into the multiple locators in Selenium WebDriver and ... Click on it and navigate to the element you wish...
Read more >Locators in Selenium: A Detailed Guide
Learn about different Locators in Selenium - ID, XPath, Name, DOM, Link, Tag & more that enables testers to act on an HTML...
Read more >Visual locators
A visual locator has two attributes - a rectangular image and a name. Two visual locators can have the same name. This means...
Read more >Web Element Locators for Test Automation
Web elements and locators are two different things. A Web element locator is an object that finds and returns Web elements on a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please check the first version of Playwright relative selector ! It allows you to select an element by its relative position to another one https://www.npmjs.com/package/playwright-relative-selector
It’s in early phase. My goal at the moment is to get feedback on it, so don’t hesitate to drop an issue here
@roughsoft I created an issue to discuss specifically of the syntax https://github.com/jfgreffier/playwright-relative-selector/issues/1
@pavelfeldman @mxschmitt @aslushnikov @yury-s @JoelEinbinder @arjun27 Given that ThoughtWorks will cease supporting Taiko (I’d say best-in-class regarding smart/proximity selectors) by the end of this year and that from 2021 on Taiko will be a fully community-managed open source project (see here), now would be a good time (re)contemplating about adding such smart selectors to Playwright as well (or, as an interim solution, explain in more detail how Taiko’s selector engines can be successfully registered and used in Playwright – see #3667). Sorry for making such a noise about it, it’s just that by my own experience with Taiko it makes creating and maintaining e2e tests a pure joy.