Ironclad Selectors is a small, injectable code snippet for a browser environment that is designed to traverse the DOM tree when elements are clicked and create selectors that are as strong and endurable as possible.
The current version currently only generates xpath selectors but future versions will support various selector types compatible with different frameworks.
Include dist/index.js
in your project. You can build a minified version by running yarn build
.
There is a watch script for development: yarn watch
. As this is a pre-alpha version it is currently being combined with utilizing an external live server (such as VSCode extension Live Server) to develop against.
This project is designed to act as a separate and maintainable library for generating strong DOM selectors that are decoupled from any existing project. The main motivation for creating this package is to ensure projects such as Playback Singers create selectors that are as strong and resistant to change as possible, ensuring users with less technical knowledge can create and maintain tests utilizing best practice.
Possibly! I found out about Playwright's selector engine after I started this project. I was hoping they had utilized an external library for generating selectors but they have created their own which is tightly coupled with their implementation.