Skip to content
← Back to activity

Immutable solution version

Problem with cookies injected with storage_state

Version 1Sign in to save

Complete solution

Teaches how to problem with cookies injected with storage_state. Based on a real issue report and its verified fix.

The problem

Issue browser-use/browser-use#2799 (closed, 23 comments): ### Browser Use Version 0.6.1 ### LLM Model Other (specify in description) ### Screenshots, Description, and task prompt given to Agent I am using gpt-5. prompt: ``` """ 1. Navigate to the station status page: https://poc18.demo.dev.charge.ampeco.tech/admin/resources/evses/4. 2. Wait until the page is fully loaded. 3. Use the function 'clickactionsand_reset' to click the Actions button and the reset option 4. In the form that appears: - Enter "Soft" into the Type field. - Enter "Any" into the Reason field. - Click the "Run Action" button. 5. Wait 5 seconds for the station to restart. 6.

What to do

Inject the cookies through the browser session start event instead of setting them after launch. The confirmed workaround:

  1. Hook BrowserStartEvent on your agent.
  2. Wait for the CDP connection to be ready.
  3. Call cdpset_cookies with your cookie list.
  4. Keep the browser session alive across agent steps so the cookies persist.

Users confirmed the agent then runs authenticated. Setting cookies after the page loads does not stick, because the session resets.

Evidence

In the GitHub issue gh:browser-use/browser-use#2799 (https://github.com/browser-use/browser-use/issues/2799), the problem reported was: Issue browser-use/browser-use#2799 (closed, 23 comments): ### Browser Use Version 0.6.1 ### LLM Model Other (specify in description) ### Screenshots, Description, and task prompt given to Agent I am using gpt-5. prompt: ``` """ 1. Navigate to the station status page: https://poc18.demo.dev.charge.ampeco.tech/admin/resources/evses/4. 2. Wait until the page is fully loaded. 3. Use the function 'clickactionsand_reset' to click the Actions button and the reset option 4. In the form that appears: - Enter "Soft" into the Type field. - Enter "Any" into the Reason field. - Click the "Run Action" button. 5. Wait 5 seconds for the station to restart. 6. The verified resolution was: Inject the cookies through the browser session start event instead of setting them after launch. The confirmed workaround:

  1. Hook BrowserStartEvent on your agent.
  2. Wait for the CDP connection to be ready.
  3. Call cdpset_cookies with your cookie list.
  4. Keep the browser session alive across agent steps so the cookies persist.

Users confirmed the agent then runs authenticated. Setting cookies after the page loads does not stick, because the session resets.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_14q_PvKd80rX9DzKf9q4UA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Problem with cookies injected with storage_state <span>— Vectle</span></a>

Problem with cookies injected with storage_state | Vectle