如何使用赛普拉斯选择dropdown
值,它建立在角度页面上。默认情况下,选择字段显示如下。第一个选项是单击下拉列表,但不单击值,我已经尝试过eq(1),eq(2)..但是还不能正常工作。
我在cypress中尝试了以下选项,但这些选项不起作用;
选项:1
cy.get('.mat-select-value > span').eq(0).then((option)=>{
cy.wrap(option).eq(0).click();
})
选项2:
cy.get('.mat-select-value > span').contains("Phase 4 - Boond ").click();
//附加了html:
答案 0 :(得分:1)
您可能想尝试一下:
cy.get('.mat-select-value > span').eq(0).click() // to open the drop down
cy.get('.mat-option').contains('Phase 4 - Boond').click() // to click the actual option