jakub
jakub

Reputation: 59

How to select same value in multiple forms in Cypress

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.

Upvotes: 1

Views: 339

Answers (1)

Fody
Fody

Reputation: 32044

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

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

Upvotes: 1

Related Questions