Skip to main content
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Maintain browser state across Live sessions

Enable persistence of browser cookies across Live sessions to maintain consistent test environments.

When you switch browsers or start a new session on BrowserStack Live, cookies from the previous session are lost. As a result, you need to repeat setup steps when you start a new session.

Browser State Maintenance preserves your browser’s cookies across sessions. This feature reduces setup time by restoring your previous session’s cookie state.

  • Currently, Browser State Maintenance preserves only cookies across sessions.
  • BrowserStack securely stores cookies for 30 days. If you deactivate your BrowserStack account, all stored cookies are automatically deleted.

How it helps

  • Reduce setup time: Eliminates the need to log in to websites in each session.
  • Increase productivity: Focus on testing your app instead of repeating browser setup steps.
  • Maintain cookies: Keep cookies intact across sessions to test user-specific features without repeated authentication.

Supported session configurations

  • This feature is currently supported only on Android and iOS devices with Chrome or Safari browsers.
  • The feature is supported when testing with multiple devices in a single tab. For more information, see Browser State Maintenance with Multi-device Testing.

Enable Browser State Maintenance

When you end a BrowserStack Live test session for the first time, a pop-up appears asking if you want to persist cookies across sessions.
Click Persist cookies to enable the feature.

To manually enable Browser State Maintenance during a Live test session:

  1. Log in to the Live dashboard.
  2. On the Live dashboard, select the device, OS version, and browser to start your test session.
  3. In the Live vertical toolbar, click Settings.
  4. In the Settings prompt, switch on the Persist cookies for future sessions toggle. The settings prompt in a BrowserStack Live test session with the Persist cookies option highlighted.
    The setting is saved, and a banner appears at the top of the screen indicating that cookies will be persisted and restored across sessions.

Disable Browser State Maintenance

When you disable Browser State Maintenance, cookies will not persist across sessions. However, cookies are securely stored for 30 days. If you re-enable Browser State Maintenance within this period, cookies will be restored.

To disable Browser State Maintenance:

  1. Log in to the Live dashboard.
  2. On the Live dashboard, select the device, OS version, and browser to start your test session.
  3. In the Live vertical toolbar, click Settings.
  4. In the Settings prompt, switch off the Persist cookies for future sessions toggle. The settings prompt in a BrowserStack Live test session with the Persist cookies option highlighted.
    The setting is saved, and a banner appears at the top of the screen indicating that cookies will not be persisted across sessions.
    An option to clear stored cookies appears under the Persist cookies for future sessions toggle.

Delete stored cookies

To delete your stored cookies:

  1. Log in to the Live dashboard.
  2. On the Live dashboard, select the device, OS version, and browser to start your test session.
  3. In the Live vertical toolbar, click Settings.
  4. In the Settings prompt, click Clear stored cookies below the Persist cookies for future sessions toggle. The settings prompt in a BrowserStack Live test session with the Clear cookies option highlighted.
    A banner appears at the top of the screen, indicating that cookies will be deleted after you end the session.

Browser State Maintenance with Multi-device Testing

BrowserStack Live supports Browser State Maintenance when testing with multiple devices in a single tab, also known as Multi-device Testing. When you start a multi-device testing session, the cookies of your last active device are persisted and shared across all devices in the multi-device session. Currently, only Multi-device Testing in a single tab supports Browser State Maintenance.

Manage Browser State Maintenance in a Multi-device Testing session

To manage Browser State Maintenance when testing with multiple devices in a single tab:

  1. Log in to the Live dashboard.
  2. Select your preferred device-browser combination to run your website or web app. Select your preferred device-browser combination
  3. Hover the cursor over the Plus sign on the right side of the screen and click the + Add Device button when it appears. Click the Add Device button
  4. In the device and browser selection window, choose another device-browser combination. Select another Device-browser combination
  5. Repeat steps 3 and 4 to add up to three additional devices.
  6. In the Live vertical toolbar, click Settings.
  7. To enable Browser State Maintenance, switch on the Persist cookies for future sessions toggle in the Settings prompt under the State maintenance section. The settings prompt in a BrowserStack Live test session with the Persist cookies for future sessions toggle highlighted.
    The setting is saved, and a banner appears at the top of the screen indicating that cookies will be persisted and restored across sessions.
  8. To disable Browser State Maintenance, switch off the Persist cookies for future sessions toggle. The settings prompt in a BrowserStack Live test session with the Persist cookies for future sessions toggle highlighted.
    The setting is saved, and a banner appears at the top of the screen indicating that cookies will not be persisted across sessions.

Delete stored cookies in a Multi-device Testing session

To delete your stored cookies for all devices in a Multi-device Testing session:

  1. Log in to the Live dashboard.
  2. Select your preferred device-browser combination to run your website or web app.
  3. Hover the cursor over the Plus sign on the right side of the screen and click the + Add Device button when it appears.
  4. In the device and browser selection window, choose another device-browser combination.
  5. In the Settings prompt, click Clear stored cookies below the Persist cookies for future sessions toggle. The settings prompt in a BrowserStack Live test session with the Clear cookies option highlighted.
    A banner appears at the top of the screen, indicating that cookies will be cleared after you end the session.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle