(Created on )

Puppeteer: downloadPath is required in allow download behavior

The BiDi allow download policy has no downloadPath.


The BiDi allow download policy has no downloadPath.

Error message

downloadPath is required in allow download behavior

How this error happens

Allowing downloads through the BiDi context API requires an output directory. The policy alone does not tell the browser where to save files.

The snippets use a WebDriver BiDi browser named browser.

await browser.createBrowserContext({
    downloadBehavior: {
        policy: "allow",
    },
});

How to fix

Supply an absolute path to a writable directory.

const context = await browser.createBrowserContext({
    downloadBehavior: {
        policy: "allow",
        downloadPath: "/absolute/path/downloads",
    },
});

Things to keep in mind

Replace the path with a real directory available to the browser process. For a remote browser, your Node.js filesystem and the browser’s filesystem may differ.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →