Case-Insensitive Query With Retries @gleb
Case-Insensitive Query With Retries  @gleb
Uploaded November 2023 | Updated September 2026, 1 week ago
This video shows how you can use Cypress.$ jQuery method to select elements without matching the attribute casing. While cy.get does not allow you to pass "i" suffix to mark the CSS selector case-insensitive (see bug github.com/cypress-io/cypress/issues/25304) you can work around it by using Cypress.$("... i") or even retry it by doing cy.wrap(Cypress).invoke("$", "...i")
// static page, let's find all buttons with class "btn-primary" or "bTn-PrImArY"
cy.wrap(Cypress.$('button[class=btn-primary i]')).should(
'have.length',
2,
)
// dynamic page, retry the query
cy.wrap(Cypress)
.invoke('$', 'button[class=btn-primary i]')
.should('have.length', 2)
Find the full recipe at glebbahmutov.com/cypress-examples
Case-Insensitive Query With Retriescy.root Command ExampleVertical CenterRefactor Cypress Api Tests Part 3: Use cypress-mapCypress-diff Plugin DemoFind The Right Item Using The cy.within Command Or The Parent SelectorStub the BeforeUnloadEvent.prototype.preventDefault MethodType Placeholders Into The Form: manpm and cypress-await exampleUse cy.filter Command To Filter Elements By Child Element PresenceCheck N Items Or That Nothing Was FoundAppend An ElementUse Cypress Network Stub With TanStack Router
gleb bahmutov |

Case-Insensitive Query With Retries

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER