thomasdondorf / puppeteer-cluster

Puppeteer Pool, run a cluster of instances in parallel
MIT License
3.24k stars 310 forks source link

First job always fails #479

Open Shuichi-code opened 2 years ago

Shuichi-code commented 2 years ago

Hi,

Thanks to anyone who can help me with this, but whenever I run my script, the first job always fails to go to the target page.

image

The other jobs work fine enough.

I load the jobs based on the values inside a CSV file.

`const inputFilePath = 'PNPresetTemplateIds.csv'; const outputFilePath = 'done.csv';

try { dataArray = fs.readFileSync(inputFilePath) //prod //dataArray = fs.readFileSync('staging-ct-id.csv') //staging .toString('UTF8') .split(/\r?\n/); } catch(e) { console.log('Error:', e.stack); }`

... //load the tasks from a file dataArray.forEach(presetTemplateId => { cluster.queue(presetTemplateId); });

is running a foreach on the dataArray a code smell?

Any help or information would be greatly appreciated. Thanks.

tuana9a commented 2 years ago

As the error in the image tell, seem like the #wyswig-editor-preloader > div.no-margin.font-white element is not appear in less than 30s.

So maybe your job is to wait for this element, then re-check if its selector is correct or not

Shuichi-code commented 2 years ago

Thanks for replying, but the element doesn't appear because puppeteer cluster can't seem to go to a different URL that has that element for the first job. But it can for subsequent jobs.