dimanche 22 mars 2020

Puppeteer is failing to upload a file with TypeError: Failed to fetch

I've followed the documentation and examples on how to use Puppeteer's uploadFile() method.

However, I keep receiving this error message Evaluation failed: TypeError: Failed to fetch

I can't figure out why I can't automate this upload. I have a file saved in my repo that I am trying to upload.

Here is a snippet of uploadFile() code.

    await page.waitForSelector('input[type="file"]');


    const fileInput = await page.$('input[type="file"]');

    const filePath = 'path-to-my-file';

    await fileInput.uploadFile(filePath);

Any pointers on where I should look?

Aucun commentaire:

Enregistrer un commentaire