Created
September 30, 2024 23:38
-
-
Save rubysolo/562dcf9b5994b8e0f3df74f968272dce to your computer and use it in GitHub Desktop.
Debug multiple Cypress matches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.document().then(doc => { | |
let $style = doc.createElement("style"); | |
$style.innerHTML = ".highlighted-element { background-color: yellow; }"; | |
doc.head.appendChild($style); | |
}); | |
cy.get('SOME-SELECTOR') | |
.each(($el, index) => { | |
cy.wrap($el).invoke('addClass', `highlighted-element`); | |
cy.pause(); | |
cy.wrap($el).invoke('removeClass', `highlighted-element`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment