如何在Cypress中以多种形式选择相同的值

susanml
susanml
订阅者
459
文章
0
粉丝
测试交流1 219字数 85阅读0分17秒阅读模式
摘要有没有办法在多个表单(下拉列表)中选择相同的值? 我要选择的值->苹果 每个表单都以->dropdown\u表单_ 我在想这样的事情: cy。。。。

有没有办法在多个表单(下拉列表)中选择相同的值?

我要选择的值->苹果
每个表单都以->dropdownu表单_文章源自玩技e族-https://www.playezu.com/180521.html

我在想这样的事情:文章源自玩技e族-https://www.playezu.com/180521.html

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

但这不起作用,因为您只能在单个元素上调用select。文章源自玩技e族-https://www.playezu.com/180521.html 文章源自玩技e族-https://www.playezu.com/180521.html

 
    • Fody
      Fody 9

      也许你只是想申请 .每个() 命令
      cy.get(‘[id^="dropdown_form_"]’)
      .each($el => {
      cy.wrap($el).select("apple")
      })

    匿名

    发表评论

    匿名网友
    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
    确定

    拖动滑块以完成验证