storage_state, and the MCP tools browser_get_cookies / browser_set_cookies
Ask your AI agent
With the Zenrows MCP server connected, paste this prompt. Your agent picks the right Zenrows tools and settings on its own.Log in and save the session state
The demo login atscrapingcourse.com/login accepts admin@example.com / password. After you submit the form, wait for an element that appears after the login (here, the “Welcome” banner), then save the state with storage_state. The file holds cookies and local storage.
Reuse the session in a new browser
Open a new browser session, create a context fromauth.json, and go straight to the protected page.
Example output
auth.json holds the site’s cookies, including the login session:
Customize it
Troubleshooting
page.clickwaits until it times out after submitting the form: Playwright is waiting for the navigation to settle. Click withno_wait_after=True(noWaitAfter: truein Node.js) and wait for an element of the logged-in page instead.- The second session lands on the login page: the saved session expired or the site ties it to an IP. Log in again to refresh
auth.json, and use the sameproxy_countryon both sessions. auth.jsonhas no session cookie: the state was saved before the login finished. Save it after the post-login element appears.
Related recipes
Fill and submit multi-step forms
Type, select and submit, then verify the result on the page.
Connect Playwright or Puppeteer to Zenrows Browser
The connection URL and its country, region and lifetime options.
Let your AI assistant browse with Browser tools
Log in, click and read pages from Claude, Cursor or the CLI.
Keep the same IP and submit forms
Reuse an IP and submit forms with Fetch, no browser needed.