A playwright javascript library that returns multiple relative xpaths of a web element
Follow the steps to setup the project
Node JS can be downloaded from the following link - https://nodejs.org/en/download
VS Code is my preferred IDE for playwright projects. But any other IDE is fine.
- Install VS Code playwright extension from Microsoft and follow instructions on the extension page - https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright
use npm i getxpaths to install the module create a .js file and use the following- const x = require('getxpaths'); x.findXpaths();
Open terminal and make sure you are at the root path of the project. Then type in the following command in terminal and press enter
node filename.js
Follow the steps to use the library
- In the chromium browser press F12 to open developer console
- Go to console tab
- Clear console
- Move your mouse over the page to see that elements are getting highlighted
- Right-Click on any element and an array of xpaths appears in the browser console.
- Expand the array to see the xpaths