CodeceptJS 如何返回一个元素数组? - 类似于 querySelectorAll

问题描述

在控制台中写入以下命令:

document.querySelectorAll("[type='checkBox']")

返回:

NodeList(12) [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)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)