Skip to main content
Use this example to capture browser state after login—including cookies, localStorage, and sessionStorage—so you can debug authentication flows and reuse tokens in downstream steps. This page is intentionally keyword-rich so you can find it by searching for: cookies, localStorage, sessionStorage, browser storage, auth token, state extraction, storage state.

Overview

This automation:
  • Logs in to a site (email + password)
  • Runs a state extraction to capture:
    • page_url, page_title
    • local_storage, session_storage
    • cookies, document_cookie
The full example automation lives at optexity/examples/login_cookies.json.

Minimal example

After your login interaction steps, add a state extraction node:
{
  "type": "action_node",
  "extraction_action": {
    "state": {}
  },
  "before_sleep_time": 5,
  "end_sleep_time": 0
}

Full automation (from login_cookies.json)

{
  "url": "https://dev.dashboard.optexity.com/login",
  "parameters": {
    "input_parameters": {
      "email": ["test@gmail.com"],
      "password": ["12345678"]
    },
    "generated_parameters": {}
  },
  "nodes": [
    {
      "type": "action_node",
      "interaction_action": {
        "input_text": {
          "command": "get_by_role(\"textbox\", name=\"Email\")",
          "prompt_instructions": "Enter the email address {email[0]} into the Email field.",
          "input_text": "{email[0]}"
        }
      }
    },
    {
      "type": "action_node",
      "interaction_action": {
        "input_text": {
          "command": "get_by_role(\"textbox\", name=\"Password\")",
          "prompt_instructions": "Enter the password into the Password field.",
          "input_text": "{password[0]}"
        }
      }
    },
    {
      "type": "action_node",
      "interaction_action": {
        "click_element": {
          "command": "get_by_role(\"button\", name=\"Sign In\", exact=True)",
          "prompt_instructions": "Click the 'Sign In' button to log into the dashboard."
        }
      }
    },
    {
      "type": "action_node",
      "extraction_action": {
        "state": {}
      },
      "before_sleep_time": 5,
      "end_sleep_time": 0
    }
  ]
}

What you get back

The state extraction appends an OutputData.json_data object with keys:
KeyDescription
page_urlCurrent page URL
page_titleCurrent page title
local_storageAll localStorage key/value pairs
session_storageAll sessionStorage key/value pairs
cookiesCookies from the current browser context
document_cookiedocument.cookie for the current page

When to use this

GoalWhy this helps
Debug login issuesConfirm if the app uses cookies vs localStorage/sessionStorage tokens
Capture tokens for API callsMany apps store auth tokens in localStorage/sessionStorage
Validate you landed on the right pagepage_url and page_title confirm navigation after login