[Question]: retrieve DOM path for locator / element
See original GitHub issueYour question
Hi,
Thanks for all the good work on Playwright 😉
I wonder if there is any way to retrieve the DOM path of a matched (through locator
) HTML element?
Something like
foo = await page.locator("text=Sign up").click()
print(foo.dom_path()) # body > div#bar > div:nth-42 > p
Hope I make myself clear, thanks in advance
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Locating DOM elements using selectors - Web APIs | MDN
The Selectors API provides methods that make it quick and easy to retrieve Element nodes from the DOM by matching against a set...
Read more >Get the DOM path of the clicked <a> - javascript - Stack Overflow
Here is a solution for exact matching of an element. It is important to understand that the selector (it ...
Read more >How To Access Elements in the DOM - DigitalOcean
The easiest way to access a single element in the DOM is by its unique ID. You can get an element by ID...
Read more >How to locate an element on the page - Web Performance
What is an Element? Everything you see on the page is an element. · What is an Element Locator? · How does each...
Read more >Locators in Selenium- How To Locate Elements On Web-page?
If you wish to learn the easiest way to locate elements on a webpage, you can check out the Selenium Certification. Locating elements...
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
This is awesome and thus your are awesome! Will have a look on this, thanks 😉
there you go: https://pypi.org/project/playwright-dompath/ Source at: https://github.com/alexferrari88/playwright-dompath-py
you are welcome 😉