How do I get Cypress just to process the visible element?

This didn't work for me on a button I was trying to get:

cy.get('[data-cy-component=single-picker-search] button:visible')

This is what ended up working for me:

cy.get('[data-cy-component=single-picker-search]').filter(':visible')


Got it. You can use pseudo selector :visible so you will be able to do

cy.get('[data-cy-component=single-picker-search] input:visible').type(...)

or in case if more than one is visible select first visible input

cy.get('[data-cy-component=single-picker-search] input:visible').first().type(...)

Tags:

Cypress