3 ms·
So it looks like this keys off of class selectors. Anyone know of a solution for cases where you have dynamic selector names? Frameworks like next.js (using sty
by rgbrgb 6y ago
So it looks like this keys off of class selectors. Anyone know of a solution for cases where you have dynamic selector names? Frameworks like next.js (using styled-jsx) add random strings to class names at build to create classname uniqueness [0].
[0]: https://github.com/vercel/styled-jsx#how-it-works https://github.com/vercel/styled-jsx#how-it-works
EDIT: Looks like one solution is to put an ID on the elements you're interacting with. [1]
[1]: https://github.com/checkly/headless-recorder/issues/32 https://github.com/checkly/headless-recorder/issues/32
- echelon 6y agoI imagine in the future we'll have ML-backed tools to give instructions like "Find the submit button", and that they'll be able to account for A/B testing and other things that get in the way of automation.
- rgbrgb 6y agoYeah, this is a cool idea. Came across a version of this the other day, though would love to see something open source [0]. The less "smart" way of solving this is to look at the contents of the element like Cypress' `contains` [1]. [0]: https://walrus.ai/ https://walrus.ai/ [1]: https://docs.cypress.io/api/commands/contains.html#Syntax https://docs.cypress.io/api/commands/contains.html#Syntax
- alufers 6y agoMaybe in the future we could have accessible controls which are accessible for non-graphical interfaces such as screen readers and automated systems.
- thesandlord 6y agoWe use https://taiko.dev/ https://taiko.dev/ to do E2E testing, and it's basically that. It's very far from perfect but dramatically cuts down needing to use selectors or IDs
- arthurfm 6y agoSikuliX [1] perhaps? It's an image-based automation tool. [1] https://github.com/RaiMan/SikuliX1 https://github.com/RaiMan/SikuliX1
- tfsh 6y agoIf the DOM structure is consistent, using xpath [1] may be an okay addition. [1]: https://developer.mozilla.org/en-US/docs/Web/XPath https://developer.mozilla.org/en-US/docs/Web/XPath