how to execute playwright codegen with disabling web security

Viewed 894

I was trying to run this command

npx playwright codegen <URL> 

But its opening the browser with web security.

How to use codegen with disable-web-security as we do while launching chromium.

1 Answers

You can't do that from the command line directly.

You need to call page.pause() from your script (where you already have started the browser without security), this will pause the script execution and open a new codegen window (in addition to the browser).

If you would like to use codegen in some non-standard setup (for example, use browserContext.route(url, handler[, options])), it is possible to call page.pause() that will open a separate window with codegen controls.

See https://playwright.dev/docs/cli/#codegen-with-custom-setup for an example.

Related