Rayrun
โ† Back to Discord Forum

codegen using logged in user ?

Hello ๐Ÿ‘‹ , is there a way to create a new playwright script using codegen from a already logged in state? I have a setup project that logs in and 2fa authorizes, so I am trying to create many new scripts from that point on and don't want to login and authorize every time. Thanks for the advice!

This thread is trying to answer question "Is there a way to create a new playwright script using codegen from an already logged in state?"

3 replies

Hi Sam!

Did u try to use npx playwright codegen --save-storage=/storage/userStorageState.json ?

And in your test you can use test.use({ storageState: './storage/userStorageState.json' });

refactoreric

Hi, storage state is a good suggestion from pandahora. Especially for eventually running the tests and skipping the authentication.

For recording the tests from a logged in state, you can (also?) use: https://playwright.dev/docs/running-tests#debug-tests-with-the-playwright-inspector

Also the Playwright extension in vscode allows you to 'record at cursor'.

thanks fo the advice, i'll give those a try!

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].