← Browse

@sunwood-ai-labs/logged-in-google-chrome

B

Launch and reuse a Google Chrome session that is logged into a Google account by using a dedicated user-data-dir and attaching Playwright over CDP after manual login. Use when Codex needs to work with Gmail, Google Account pages, or other Google web apps without triggering the "browser or app may not be secure" login block from a Playwright-launched browser.

skillclaude

Install

agr install @sunwood-ai-labs/logged-in-google-chrome --target claude

Writes 4 files into .claude/skills/, pinned to git-f83d839b.

  • .claude/skills/logged-in-google-chrome/.gitignore
  • .claude/skills/logged-in-google-chrome/README.ja.md
  • .claude/skills/logged-in-google-chrome/README.md
  • .claude/skills/logged-in-google-chrome/SKILL.md

Document


name: logged-in-google-chrome description: Launch and reuse a Google Chrome session that is logged into a Google account by using a dedicated user-data-dir and attaching Playwright over CDP after manual login. Use when Codex needs to work with Gmail, Google Account pages, or other Google web apps without triggering the "browser or app may not be secure" login block from a Playwright-launched browser.

Logged In Google Chrome

Use a dedicated Chrome user-data-dir and attach Playwright only after Chrome is already running.

Quick Start

  1. Run scripts/launch_logged_in_chrome.ps1 to start normal Chrome with a dedicated profile folder and a CDP port. The script now waits for the dedicated-profile Chrome process and the CDP endpoint before it reports success.
  2. Let the user log in manually if the profile is not logged in yet.
  3. In js_repl, attach Playwright with chromium.connectOverCDP("http://127.0.0.1:<port>").
  4. Reuse the attached browser and page handles for the rest of the task.

Defaults

  • Default user-data-dir: D:\Prj\onizuka-playwright-profile
  • Default CDP port: 9222
  • Default login URL: https://accounts.google.com/

Rules

  • Do not log into Google from a Playwright-launched Chrome window.
  • Do not point Playwright at %LOCALAPPDATA%\Google\Chrome\User Data.
  • Do use a dedicated user-data-dir that is separate from the user's everyday Chrome profile.
  • Do launch Chrome first as a normal browser, then attach Playwright over CDP.
  • Do keep the attached CDP browser alive across steps instead of reconnecting unless the process changed.

Launch

Run:

powershell -ExecutionPolicy Bypass -File .\scripts\launch_logged_in_chrome.ps1

Do not assume launch succeeded just because a command returned. Only continue when the launch script exits successfully or scripts/check_cdp_port.ps1 confirms the CDP endpoint.

If a stale browser is already using the same profile folder, close it first:

powershell -ExecutionPolicy Bypass -File .\scripts\close_logged_in_chrome.ps1

Attach From js_repl

Use a local workspace that already has playwright or playwright-core installed, then attach:

var chromium;
var attachedBrowser;
var attachedContext;
var attachedPage;

{
  const nm = await import("node:module");
  const requireForPw = nm.createRequire("file:///D:/Prj/demo/package.json");
  ({ chromium } = requireForPw("playwright-core"));

  attachedBrowser = await chromium.connectOverCDP("http://127.0.0.1:9222");
  attachedContext = attachedBrowser.contexts()[0];
  attachedPage = attachedContext.pages()[0];
}

After attaching, navigate and automate normally.

Verify Before Automating

  • Confirm the browser window is the dedicated profile, not the user's main Chrome.
  • Confirm the user has finished manual login if the task depends on Google auth.
  • Confirm the CDP endpoint is reachable by running scripts/check_cdp_port.ps1 before attaching if launch behavior looked suspicious.
  • If launch times out or the dedicated-profile chrome.exe process does not appear, stop and relaunch instead of trying to attach anyway.

Troubleshooting

Read references/troubleshooting.md when:

  • Google shows "This browser or app may not be secure"
  • connectOverCDP() fails
  • the CDP endpoint is not reachable
  • the launch script returns but no Chrome process is using the dedicated profile
  • a stale profile lock prevents launch

Trustgrade B

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • warnLicenseno SPDX license detected

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-f83d839bb0162026-07-31