login-machine

RichardHrubyMIT更新放缓

用 Claude 识别登录页面的类型和表单结构,再由 Playwright 自动完成填写与登录,省去为每个网站手写登录脚本的麻烦。

AI-powered login automation. Uses Claude to classify login pages and Playwright to interact with them.

暂无版本292star22fork同步于 2026-11-07 07:31 UTC

怎么上手

由 README 提炼,执行前请确认
cp .env.example .env.local
npm install
npm run dev
硬件要求按 README 说明

README 未说明本地硬件要求;浏览器运行在 BrowserBase 云端,通过 CDP 由 Playwright 控制,本地只需能跑 Next.js 开发服务器

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Claude 加 Playwright 的单一 agent 循环登录任意网站,替代逐站硬编码脚本

用 Claude 识别登录页面的类型和表单结构,再由 Playwright 自动完成填写与登录,省去为每个网站手写登录脚本的麻烦。

核心能力

  • 剥离无关 HTML 并穿透 Shadow DOM 提取表单,省约 10 倍 token
  • LLM 只输出字段与定位器,凭据由用户直接写入浏览器 DOM
  • 每个 Playwright 定位器先对活 DOM 校验,失败带错误上下文重试最多 3 次
  • 把页面归为六类屏幕(凭据表单、选择页、魔法链接、加载、拦截、已登录)分别处理
  • 加载页自动等待重析最多 12 次,拦截弹窗自动关闭后重析

容易踩的坑

需自行填好 ANTHROPIC_API_KEY、BROWSERBASE_API_KEY 和 BROWSERBASE_PROJECT_ID 三个环境变量才能运行;浏览器依赖 BrowserBase 云服务,不是本地起 Chromium;开发服务器默认监听 3000 端口,被占用需另行处理

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Why

    If you're building browser agents that need to log into websites, you know the pain. Every website has a different login flow, and traditional automation means writing a dedicated script for each one. Hardcoded selectors, brittle state machines, everything breaks when a site ships a redesign.

    But login pages are designed for humans. Every screen is self-contained. You can always figure out what to do just by looking at it. An LLM with vision can do the same.

    At Anon the Login Machine replaced hundreds of per-website scripts with a single agent loop that works for any login flow: multi-step credentials, SSO pickers, MFA prompts, magic links, all handled by the same code.

    Quick Start

    cp .env.example .env.local
    # Fill in your API keys
    npm install
    npm run dev
    

    Open http://localhost:3000 and paste a login URL, or try the hosted demo.

    Environment Variables

    VariableDescription
    ANTHROPIC_API_KEYAnthropic API key for Claude
    BROWSERBASE_API_KEYBrowserBase API key
    BROWSERBASE_PROJECT_IDBrowserBase project ID

    How It Works

    flowchart TD
        A(["Navigate to login page"]) --> B["Take Screenshot<br/>+ Extract HTML"]
        B --> C["LLM Classifies<br/>Screen Type"]
        C --> D{"Logged in?"}
        D -->|"No"| F["Request Input<br/>from User"]
        D -->|"Yes"| E(["Done"])
        F --> G["Submit Input<br/>in Browser"]
        G --> B
    

    Stripped HTML + screenshot. Raw page HTML is full of scripts, styles, SVGs, and tracking pixels. The extractor walks the DOM recursively, strips everything except form-relevant tags and attributes, and traverses Shadow DOM boundaries so enterprise SSO widgets aren't missed. This cuts token usage by roughly 10x on complex pages and reduces hallucinated locators.

    Credential isolation. The LLM analyzes the page and returns structured data describing what fields exist and their Playwright locators. It never sees what the user types. Credentials flow directly from the user into the browser DOM via Playwright.

    Self-correcting locators. Every LLM-generated Playwright locator is validated against the live DOM before use. If a locator doesn't match, the error is fed back to the LLM in <error-history> tags for retry with context (up to 3 attempts).

    Screen Types

    The LLM classifies every page into one of six types, each with a strict Zod schema:

    TypeWhat It IsHow It's Handled
    credential_login_formEmail, password, OTP fields + submit buttonShows dynamic form → user fills → agent types into DOM
    choice_screenAccount picker, SSO options, workspace selectorShows buttons → user picks → agent clicks
    magic_login_link"Check your email" screensShows URL input → user pastes link → agent navigates
    loading_screenSpinners, redirects, Cloudflare challengesAuto-waits and re-analyzes (max 12 retries)
    blocked_screenCookie banners, popups blocking the flowAuto-dismisses and re-analyzes
    logged_in_screenDashboard, homepageTerminal success state

    Design Principles

    1. Observe, don't assume. Every action is followed by a fresh page analysis. The system never guesses what screen comes next.
    2. Validate before acting. LLM outputs are checked against the live DOM. Hallucinated selectors are caught and corrected before they cause errors.
    3. Fail forward with context. When something goes wrong, the error becomes part of the next attempt's context. The LLM doesn't repeat the same mistake.

    Architecture

    src/
    ├── app/api/chat/route.ts           # Single API endpoint (start/submit/close)
    ├── components/
    │   ├── chat.tsx                     # Main UI shell (browser + chat columns)
    │   ├── message-bubble.tsx           # Dynamic message rendering
    │   ├── credential-form.tsx          # Login form with inline errors
    │   ├── choice-buttons.tsx           # SSO / option selection
    │   ├── magic-link-input.tsx         # Magic link URL input
    │   └── log-panel.tsx               # Terminal-style log viewer
    ├── hooks/use-login-session.ts       # State management + SSE streaming
    └── lib/ai-login/
        ├── agent.ts                     # LLM analysis + screen handlers
        ├── browser.ts                   # BrowserBase + Playwright (stateless)
        ├── prompts.ts                   # System prompt for classification
        └── types.ts                     # Zod schemas for all screen types
    

    Stack

    ComponentTechnology
    FrontendNext.js 16, React 19, Tailwind 4
    LLMClaude Sonnet 4.5 via Vercel AI SDK
    BrowserPlaywright over CDP via BrowserBase
    ValidationZod schemas + live DOM locator checks

    License

    MIT. See LICENSE.