0
我想通过Nightmare.js获取NodeList迭代。在开发工具中执行按预期执行,但在ElectronI中无法成功将NodeList转换为数组。电子Nightmare.js NodeList到阵列
nightmare
.goto('https://www.somePage.com')
.wait('#someID')
.evaluate(function() {
var links = document.querySelectorAll('div.someClass')
return links;
})
.end()
.then(function (result) {
console.log(result); // outputs the NodeList successfully.
var nodesArray = Array.prototype.slice.call(result);
console.log(nodesArray.length) // Always 0
})
.catch(function (error) {
console.error('Failed',
error);
})
我试着通过各种方法移植的节点列表。没有任何接缝可以在Electron中工作。再次,这在铬工具中很容易实现。