Install with npm: Open your Terminal and write this command: npm install -D cypress-xpath Install with Yarn: Open Terminal and write this Command: yarn add cypress-xpath --dev Now Open project's index.js file cypress/support/index.js just Paste this in index.js file. require ( ' cypress-xpath ' ) Use of xpath: After installation your cy object will have xpath command. it ( ' finds input filed ' , ( ) => { cy . xpath ( '/html[1]/body[1]/input[1] ' ) . type ('Hello ' ) } ) You can also chain xpath off of another command. it ( ' finds list items ' , ( ) => { cy . xpath ( ' /html[1]/body[1]/input[1] ' ) . xpath ( ' ./li ' ) . should ( ' have.length ' , 2 ) } ) As with other cy commands, it is scoped by cy.within() . it ( ' finds list items ' , ( ) => { cy . xpath ( ' /html[1]/body[1]/input[1] ' ) . within ( ( ) => { cy . xpath (
Cypress Automation Solution website is to post the issues and their best solutions to the Cypress Automation Community.