Setup Browser Cookies
Imports cookies from a real Chromium browser into the active headless browser session
Category: development Source: garrytan/gstackWhat Is This?
Overview
The Setup Browser Cookies skill enables developers and QA engineers to import cookies from a real Chromium browser session into a headless browsing environment. This process bridges the gap between authenticated browser states and automated testing workflows, allowing teams to carry over login sessions, preferences, and session tokens without manually re-authenticating in every test run.
When working with headless browsers in automated pipelines, one of the most common friction points is authentication. Most modern web applications require valid session cookies to access protected pages, dashboards, or API-driven interfaces. This skill solves that problem by providing an interactive picker UI that lets you select specific cookie domains to import, giving you precise control over which credentials and session data are transferred.
The skill integrates with tools such as Bash and file reading utilities, and it works by reading cookies from your local Chromium profile and injecting them into the active headless session. It is particularly useful before QA testing authenticated pages, when you need to simulate a logged-in user without going through a full login flow programmatically.
Who Should Use This
- QA engineers who need to test authenticated pages in headless browsers without scripting full login sequences
- Frontend developers testing protected routes, dashboards, or user-specific content in automated workflows
- DevOps engineers building CI pipelines that require authenticated browser sessions for smoke tests or end-to-end checks
- Security researchers who need to replicate authenticated browser states for vulnerability assessments
Why Use It?
Problems It Solves
- Eliminates the need to script complex login flows for every automated test run involving authenticated pages
- Prevents session expiration issues that occur when headless browsers cannot maintain cookies across test sessions
- Reduces test setup time by reusing existing authenticated sessions from a real browser
- Avoids storing plaintext credentials in test scripts or environment variables just to handle login steps
- Resolves inconsistencies between manual browser behavior and headless browser behavior caused by missing cookies
Core Highlights
- Interactive domain picker UI for selecting which cookies to import
- Reads directly from your local Chromium browser profile
- Supports multiple cookie domains in a single import session
- Works with headless browsing tools used in automated QA pipelines
- Reduces authentication overhead in development and testing workflows
- Compatible with session cookies, persistent cookies, and authentication tokens
- Designed for use before running tests on protected or login-gated pages
How to Use It?
Basic Usage
To trigger the cookie import process, invoke the skill at the start of your headless browser session setup. The interactive picker will display available cookie domains from your Chromium profile.
## Start the cookie import process
run-skill setup-browser-cookies
## The picker UI will display available domains, for example:
## [1] accounts.google.com
## [2] github.com
## [3] staging.yourapp.com
## Select domains to import (comma-separated): 3
Specific Scenarios
Scenario 1: QA testing a staging environment Before running your test suite against a staging URL that requires authentication, invoke the skill to import cookies for the staging domain. This ensures the headless browser starts with a valid session.
Scenario 2: Authenticated scraping or monitoring When building a monitoring script that checks content behind a login wall, use this skill to import the necessary session cookies rather than embedding credentials in your script.
Real-World Examples
Example 1: Pre-test setup in a shell script
#!/bin/bash
## Import cookies before running Playwright tests
run-skill setup-browser-cookies
npx playwright test --project=authenticated-suite
Example 2: Manual invocation during development
## Developer workflow: import cookies, then open headless session
run-skill setup-browser-cookies
run-headless-browser --url https://app.internal.com/dashboard
When to Use It?
Use Cases
- Before running automated tests on pages that require user authentication
- When setting up a headless browser session for a new QA cycle
- When asked to "import cookies," "login to the site," or "authenticate the browser" in a workflow
- During local development when testing protected routes without a full login script
- When replicating a specific user session state for debugging a reported issue
- Before running end-to-end tests in a CI environment that cannot perform interactive logins
- When monitoring authenticated dashboards or internal tools with a headless agent
Important Notes
Requirements
- A local Chromium-based browser with an active, authenticated session for the target domains
- Access to the Chromium user profile directory where cookies are stored
- Bash environment and file read permissions for the skill to access cookie data
- A configured headless browser session that the imported cookies will be applied to