getxpaths
v1.0.5
Published
A playwright javascript library that returns multiple relative xpaths of a web element
Downloads
6
Readme
getXpaths
A playwright javascript library that returns multiple relative xpaths of a web element
Setup
Follow the steps to setup the project
Install NodeJS
Node JS can be downloaded from the following link - https://nodejs.org/en/download
Install Visual Studio Code
VS Code is my preferred IDE for playwright projects. But any other IDE is fine.
Install Playwright
- Install VS Code playwright extension from Microsoft and follow instructions on the extension page - https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright
Install getXpaths
use npm i getxpaths to install the module create a .js file and use the following- const x = require('getxpaths'); x.findXpaths();
Run
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
Use
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