文件
目前,Puppeteer 没有提供以编程方式处理文件下载的方法。对于上传文件,你需要找到一个文件输入元素并调用 ElementHandle.uploadFile
。
const fileElement = await page.waitForSelector('input[type=file]');
await fileElement.uploadFile(['./path-to-local-file']);
目前,Puppeteer 没有提供以编程方式处理文件下载的方法。对于上传文件,你需要找到一个文件输入元素并调用 ElementHandle.uploadFile
。
const fileElement = await page.waitForSelector('input[type=file]');
await fileElement.uploadFile(['./path-to-local-file']);