While browsing a website, I extracted a table and saved it in an object. As I attempted to loop through the object, I aimed to retrieve specific table cells with a 'tag' within one object. To achieve this, I wrote the following code:
listItems = this.evaluate(function () {
var nodes = document.querySelectorAll('td');
return [].map.call(nodes, function(node, index, arr) {
var userObject = {
nom: node.innerText,
prenom: arr[index + 1].innerText
}
return userObject;
});
});
However, when using "Index + 1", it unexpectedly returns Null in some cases.