'Getting error "Uncaught Error Error: net::ERR_CONNECTION_TIMED_OUT" in nodejs WebScrapper - puppeteer
I do Android Development and I am not familiar to Nodejs and asked someone to write a web scrapper for me but I am getting this error when I run the script: Uncaught Error Error: net::ERR_CONNECTION_TIMED_OUT at https://evisatraveller.mfa.ir/fa/request/state/AINSEI0RDZ618243I5 at navigate (undefined:156:23) at processTicksAndRejections (undefined:96:5)
here is the code:
const puppeteer = require('puppeteer');
process.setMaxListeners(Infinity)
const fs = require('fs');
const csv = require('csv-parser');
var inputFile = 'app_ids.csv';
fs.createReadStream(inputFile)
.pipe(csv())
.on('data', function (data) {
try {
// console.log(data.app_id);
(async () => {
let app_id = data.app_id
console.log(app_id)
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://evisatraveller.mfa.ir/fa/request/state/' + app_id);
await page.screenshot({ path: 'output/' + app_id + '.png' });
await page.waitForTimeout(8000);
await browser.close();
})();
}
catch (err) {
console.log('Error:', err)
//error handler
}
})
.on('end', function () {
//some final operation
});
Please don't mark my question as spam or duplicate because I couldn't find the answer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
