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中工作。再次,這在鉻工具中很容易實現。