【发布时间】:2021-08-31 00:54:11
【问题描述】:
在控制台中编写以下命令:
document.querySelectorAll("[type='checkbox']")
返回:
NodeList(12) [input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719]
这正是我想在 Codeceptjs 中实现的,所以我可以稍后循环遍历元素。
我尝试过创建自定义函数,例如:
allSelector: function (selector) {
return Array.from.document.querySelectorAll(selector)
}
但是,我在控制台记录时不断收到null:
let checkboxes = (await I.grabAttributeFrom("[type='checkbox']"))
console.log(checkboxes)
【问题讨论】:
标签: javascript automation codeceptjs