(Created on )

Puppeteer: Exactly one of url, path, or content must be specified.

Script/style insertion has no usable url, path or content.


Script/style insertion has no usable url, path or content.

Error message

Exactly one of url, path, or content must be specified.

How this error happens

addScriptTag or addStyleTag needs usable source content. An empty options object supplies no URL, local path or inline content.

The snippets use an open Chrome/CDP page named page.

await page.addScriptTag({});

How to fix

Provide one source. Inline content is enough when you only need a small script.

await page.addScriptTag({
    content: "window.exampleReady = true;",
});

Things to keep in mind

For a local path, the file must exist in the Node.js runtime. The error wording says “exactly one”; do not rely on an implementation’s precedence when supplying several sources.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →