I was wondering if it’s possible to search by multiple parameters in cypress, for example ID and Class
JavaScript
x
4
1
it('find button',function(){
2
cy.get('#button_id, .button-class').click()
3
})
4
is this something that is achievable???
Advertisement
Answer
Yes you can directly use #button_id.button-class
JavaScript
1
4
1
it('find button',function(){
2
cy.get('#button_id.button-class').click()
3
})
4
In my local I cross created this element:
JavaScript
1
2
1
<div class="titleclass" id="titleid">Apple</div>
2
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.