Skip to content
Advertisement

Cypress, look for multiple parameters like ID and Class

I was wondering if it’s possible to search by multiple parameters in cypress, for example ID and Class

JavaScript

is this something that is achievable???

Advertisement

Answer

Yes you can directly use #button_id.button-class

JavaScript

In my local I cross created this element:

JavaScript

And in the test runner if you could see, I was able to use both class and id cy.get('#titleid.titleclass') and successfully get the element.

Test runner screenshot

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement