Puppeteer file-chooser upload not working

Viewed 50

I try to upload a video on instagram using puppeteer with FileChooser:

const selectBtn = await page.$x("selector...")

const [fileChooser] = await Promise.all([
  page.waitForFileChooser(),
  selectBtn[0].click()
]);

await fileChooser.accept(["./myvid.mp4"]);

But it is not working, nothing happens. Did anyone get that to work or an idea what could be wrong?

1 Answers

Following the document, it should be:

const [fileChooser] = await Promise.all([
  page.waitForFileChooser(),
  page.click('selector...'),
]);

Related