如何点击多个下拉菜单&从 cypress 的所有下拉列表中选择相同的值
我可以单击所有下拉菜单,但无法从中一一选择值。
cy.xpath('/html/body/app-root/div/mat-sidenav-container/mat-sidenav-content/app-configurable-product-management/form/div[2]/mat-card/mat-card-content/app-configurable-product-inventory/form/div/div/div/div')
.each($row => {
//Click on drop down
cy.wrap($row).find(':nth-child(4) > .common-form-field-width > .mat-form-field-wrapper > .mat-form-field-flex > .mat-form-field-infix').click({timeout: 2000, force:true})
//Select same values from all dropdown (Not working)
cy.contains('In Stock').click({timeout: 2000, force:true})
cy.wait(2000)
})
I am able to click on all dropdowns but am not able to select values from them one by one.
cy.xpath('/html/body/app-root/div/mat-sidenav-container/mat-sidenav-content/app-configurable-product-management/form/div[2]/mat-card/mat-card-content/app-configurable-product-inventory/form/div/div/div/div')
.each($row => {
//Click on drop down
cy.wrap($row).find(':nth-child(4) > .common-form-field-width > .mat-form-field-wrapper > .mat-form-field-flex > .mat-form-field-infix').click({timeout: 2000, force:true})
//Select same values from all dropdown (Not working)
cy.contains('In Stock').click({timeout: 2000, force:true})
cy.wait(2000)
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在正在工作...
It's working now...