You might like looking at the Testing Library (www.testing-library.com) group of projects which supports has support for Puppeteer and Playwright, React etc.
They use similar approach by querying elements by their ARIA roles. I think that helps to improve the accessibility of the page as you the idea is to change the markup to make it queryable through ARIA.
There is also the awesome testing playground extension for Chrome and as web-site to help write these queries: https://www.testing-playground.com
XPath and CSS selectors not ideal for testing as they tie the tests to the implementation of the page.
Looking forward to using this.