I’m hoping someone can help with this script as my nodejs skills are only basic. I’m trying to iterate each URL in the .get statement inside module.exports. The 2 console logs at the bottom iterate correctly but not the one inside module.exports.
var urls = [
{
"id": "1",
"url": "https://www.1.co.uk/"
},
{
"id": "2",
"url": "https://www.2.co.uk"
},
{
"id":"3",
"url":"https://www.3.co.uk"
}
]
// loop through URLs
for (var i = 0; i < urls.length; i++) {
var obj = urls[i];
module.exports = {
name: 'Destinology',
run: function (browser) {
return browser
get(obj.url) // <-- Here
.sleep(5000)
.title()
}
};
console.log("id:" + obj.id)
console.log("url:" + obj.url)
}