【发布时间】:2020-12-01 10:00:41
【问题描述】:
cy.get("#severities").then(($optionsArray) => {
expect($optionsArray.get(0)).to.have.property('childElementCount', 6)
let optionVal = new Array()
optionVal = $optionsArray.children()
var randomChoice = optionVal[Math.floor(Math.random() * optionVal.length) + 1]
addAppointment.selectSeverity(randomChoice.text)
})
expect 断言将失败,因为并非所有选项都已加载。
expected '<select#severities.form-control>' to have property 'childElementCount' of 7, but got 1
有没有办法用柏树来做呢?如果没有,那么使用 jQuery?
【问题讨论】:
-
var名称不合适,请更改它。另外请添加信息如何触发下拉列表以便我们为您提供帮助,您的问题没有提供足够的信息
标签: automation cypress