Home > OS >  How to select same value in multiple forms in Cypress
How to select same value in multiple forms in Cypress

Time:06-22

Is there some way how to select same value in multiple forms (dropdowns)?

value I want to select -> apple every form is starting with -> dropdown_form_

I was thinking about something like:

cy.get('[id^="dropdown_form_"]').select("apple")

but this doesn't work, because you can only call select on single element.

CodePudding user response:

Maybe you just want to apply .each() command?

cy.get('[id^="dropdown_form_"]')
  .each($el => {
    cy.wrap($el).select("apple")
  })
  • Related