如何通过Puppeteer将文件上传到输入

时间:2019-06-08 14:06:21

标签: node.js puppeteer

我试图通过puppeteer将图像文件上传到输入,但出现下一个错误:

  

(节点:16748)UnhandledPromiseRejectionWarning:TypeError:无法读取   属性“ uploadFile”为空

我已经尝试了下一个给我上面错误的代码:

const filePath = 'audio.mp3';
const input = await page.$('input[type="file"]');
await input.uploadFile(filePath);

我希望得到一些帮助:)

0 个答案:

没有答案
相关问题