puppeteer fileChooser: how to use URL instead of local file path?

345 views Asked by At

I have the http link of a video file (cloud storage) and I want to select that file in filechooser.

I am using cloud hosting (glitch), so I don't want to store that file to local storage.

const [fileChooser] = await Promise.all([
page.waitForFileChooser(),
page.click('#select-files-button')
]);
await fileChooser.accept(["https://examle.mp4"]);

It only seems to accept a local file path, can anyone help me?

1

There are 1 answers

1
F.NiX On

As you could have guessed, it obviously accepts only local files, you can download your desired file first (with request module or even http(s?) module), then pass it to puppeteer.