cypress-xpath
cypress-xpath copied to clipboard
cy.xpath() shows xpath never found even if it is present in the DOM
I am working on a React application's integration testing using cypress. For that I'm using cy.xpath() function to retrieve the xpaths of the DOM elements for doing assertions accordingly. The application consists of switching to multiple accounts option using a dropdown each producing the same React components, same xpaths but with different data in it.
Desired behaviour The xpaths of the elements are same across all the accounts in the dropdown and so when I pass the xpaths through an array and iterate over multiple accounts for doing assertion, it should work.
Current behaviour On first time when selecting first account in the dropdown, the xpaths are retrieved by cy.xpath() and assertion is done smoothly. But when switching to different account and trying to search for xpaths, cy.xpath() shows that the xpath is never found. And I found the xpath is present in the DOM but cypress shows xpath is never found.
Versions Cypress: 7.1.0 OS: Windows Server 2016 Chrome: 90.0.4430.212
I'm experiencing a similar issue.
cypress-xpath works the first time the test runs, but the next test calls the same path, but fails to find element. Both tests work when run one at a time, but back to back fail.
Closing due to inactivity