notte-browser

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Notte Browser CLI Skill

Notte Browser CLI 技能

Command-line interface for browser automation, web scraping, and AI-powered web interactions using the notte.cc platform.
基于notte.cc平台的命令行界面,用于浏览器自动化、网页数据爬取和AI驱动的网页交互。

Quick Start

快速开始

bash
undefined
bash
undefined

1. Authenticate

1. 身份验证

notte auth login
notte auth login

2. Start a browser session

2. 启动浏览器会话

notte sessions start
notte sessions start

3. Navigate and observe

3. 导航与查看

notte page goto "https://example.com" notte page observe notte page screenshot
notte page goto "https://example.com" notte page observe notte page screenshot

4. Execute actions (use @IDs from observe, or Playwright selectors)

4. 执行操作(使用observe返回的@ID,或Playwright选择器)

notte page click "@B3" notte page fill "@I1" "hello world"
notte page click "@B3" notte page fill "@I1" "hello world"

If @IDs don't work, use Playwright selectors:

如果@ID无效,使用Playwright选择器:

notte page click "button:has-text('Submit')"

notte page click "button:has-text('Submit')"

5. Scrape content

5. 爬取内容

notte page scrape --instructions "Extract all product names and prices"
notte page scrape --instructions "Extract all product names and prices"

6. Stop the session

6. 停止会话

notte sessions stop
undefined
notte sessions stop
undefined

Command Categories

命令分类

Session Management

会话管理

Control browser session lifecycle:
bash
undefined
控制浏览器会话生命周期:
bash
undefined

Start a new session

启动新会话

notte sessions start [flags] --headless Run in headless mode (default: true) --idle-timeout-minutes Idle timeout in minutes --max-duration-minutes Maximum session lifetime in minutes --proxies Use default proxies --solve-captchas Automatically solve captchas --viewport-width Viewport width in pixels --viewport-height Viewport height in pixels --user-agent Custom user agent string --cdp-url CDP URL of remote session provider --use-file-storage Enable file storage for the session
notte sessions start [flags] --headless 以无头模式运行(默认:true) --idle-timeout-minutes 空闲超时时间(分钟) --max-duration-minutes 会话最长生命周期(分钟) --proxies 使用默认代理 --solve-captchas 自动解决验证码 --viewport-width 视口宽度(像素) --viewport-height 视口高度(像素) --user-agent 自定义用户代理字符串 --cdp-url 远程会话提供商的CDP地址 --use-file-storage 启用会话文件存储

Get current session status

获取当前会话状态

notte sessions status
notte sessions status

Stop current session

停止当前会话

notte sessions stop
notte sessions stop

List sessions (with optional pagination and filters)

列出会话(支持可选分页和筛选)

notte sessions list [--page N] [--page-size N] [--only-active]

**Note:** When you start a session, it automatically becomes the "current" session (i.e NOTTE_SESSION_ID environment variable is set). All subsequent commands use this session by default. Use `--session-id <session-id>` only when you need to manage multiple sessions simultaneously or reference a specific session.

Session debugging and export:

```bash
notte sessions list [--page N] [--page-size N] [--only-active]

**注意**:启动会话后,它会自动成为“当前”会话(即设置NOTTE_SESSION_ID环境变量)。后续所有命令默认使用该会话。仅当需要同时管理多个会话或引用特定会话时,才使用`--session-id <session-id>`参数。

会话调试与导出:

```bash

Get network logs

获取网络日志

notte sessions network
notte sessions network

Get replay URL/data

获取回放URL/数据

notte sessions replay
notte sessions replay

Export session steps as Python workflow code

将会话步骤导出为Python工作流代码

notte sessions workflow-code

Cookie management:

```bash
notte sessions workflow-code

Cookie管理:

```bash

Get all cookies

获取所有Cookie

notte sessions cookies
notte sessions cookies

Set cookies from JSON file

从JSON文件设置Cookie

notte sessions cookies-set --file cookies.json
undefined
notte sessions cookies-set --file cookies.json
undefined

Page Actions

页面操作

Simplified commands for page interactions:
Element Interactions:
bash
undefined
简化的页面交互命令:
元素交互
bash
undefined

Click an element (use either the ids from an observe, or a selector)

点击元素(使用observe返回的ID,或选择器)

notte page click "@B3" notte page click "#submit-button" --timeout Timeout in milliseconds --enter Press Enter after clicking
notte page click "@B3" notte page click "#submit-button" --timeout 超时时间(毫秒) --enter 点击后按回车键

Fill an input field

填写输入框

notte page fill "@I1" "hello world" --clear Clear field before filling --enter Press Enter after filling
notte page fill "@I1" "hello world" --clear 填写前清空输入框 --enter 填写后按回车键

Check/uncheck a checkbox

勾选/取消勾选复选框

notte page check "#my-checkbox" --value true to check, false to uncheck (default: true)
notte page check "#my-checkbox" --value true表示勾选,false表示取消勾选(默认:true)

Select dropdown option

选择下拉选项

notte page select "#dropdown-element" "Option 1"
notte page select "#dropdown-element" "Option 1"

Download file by clicking element

点击元素下载文件

notte page download "@L5"
notte page download "@L5"

Upload file to input

向输入框上传文件

notte page upload "#file-input" --file /path/to/file
notte page upload "#file-input" --file /path/to/file

Run JavaScript in the Page

在页面中运行JavaScript

  • Escape single quotes if needed.
  • Don’t use logging (output won’t be captured).
  • Use a single statement or a function that returns a value.
  • 如有需要,转义单引号。
  • 不要使用日志(输出不会被捕获)。
  • 使用单个表达式或带返回值的函数。

Single expression

单个表达式

notte page eval-js 'document.title'
notte page eval-js 'document.title'

Function with return value

带返回值的函数

notte page eval-js ' () => { const els = document.querySelectorAll("a"); return els.length; } '

**Navigation:**
```bash
notte page goto "https://example.com"
notte page new-tab "https://example.com"
notte page back
notte page forward
notte page reload
Scrolling:
bash
notte page scroll-down [amount]
notte page scroll-up [amount]
Keyboard:
bash
notte page press "Enter"
notte page press "Escape"
notte page press "Tab"
Tab Management:
bash
notte page switch-tab 1
notte page close-tab
Page State:
bash
undefined
notte page eval-js ' () => { const els = document.querySelectorAll("a"); return els.length; } '

**导航**:
```bash
notte page goto "https://example.com"
notte page new-tab "https://example.com"
notte page back
notte page forward
notte page reload
滚动
bash
notte page scroll-down [amount]
notte page scroll-up [amount]
键盘操作
bash
notte page press "Enter"
notte page press "Escape"
notte page press "Tab"
标签页管理
bash
notte page switch-tab 1
notte page close-tab
页面状态
bash
undefined

Observe page state and available actions

查看页面状态和可用操作

notte page observe
notte page observe

Save a screenshot in tmp folder

在临时文件夹保存截图

notte page screenshot
notte page screenshot

Scrape content with instructions

根据指令爬取内容

notte page scrape --instructions "Extract all links" [--only-main-content]

**Utilities:**
```bash
notte page scrape --instructions "Extract all links" [--only-main-content]

**实用工具**:
```bash

Wait for specified duration

等待指定时长

notte page wait 1000
notte page wait 1000

Solve CAPTCHA

解决验证码

notte page captcha-solve "recaptcha"
notte page captcha-solve "recaptcha"

Mark task complete

标记任务完成

notte page complete "Task finished successfully" [--success=true]
notte page complete "Task finished successfully" [--success=true]

Fill form with JSON data

使用JSON数据填充表单

notte page form-fill --data '{"email": "test@example.com", "name": "John"}'
undefined
notte page form-fill --data '{"email": "test@example.com", "name": "John"}'
undefined

AI Agents

AI Agent

Start and manage AI-powered browser agents:
bash
undefined
启动和管理AI驱动的浏览器Agent:
bash
undefined

List all agents (with optional pagination and filters)

列出所有Agent(支持可选分页和筛选)

notte agents list [--page N] [--page-size N] [--only-active] [--only-saved]
notte agents list [--page N] [--page-size N] [--only-active] [--only-saved]

Start a new agent (auto-uses current session if active)

启动新Agent(如果有活跃会话则自动使用)

notte agents start --task "Navigate to example.com and extract the main heading" --session-id Session ID (uses current session if not specified) --vault-id Vault ID for credential access --persona-id Persona ID for identity --max-steps Maximum steps for the agent (default: 30) --reasoning-model Custom reasoning model
notte agents start --task "Navigate to example.com and extract the main heading" --session-id 会话ID(未指定则使用当前会话) --vault-id 用于凭证访问的Vault ID --persona-id 身份Persona ID --max-steps Agent的最大步骤数(默认:30) --reasoning-model 自定义推理模型

Get current agent status

获取当前Agent状态

notte agents status
notte agents status

Stop current agent

停止当前Agent

notte agents stop
notte agents stop

Export agent steps as workflow code

将Agent步骤导出为工作流代码

notte agents workflow-code
notte agents workflow-code

Get agent execution replay

获取Agent执行回放

notte agents replay

**Note:** When you start an agent, it automatically becomes the "current" agent (saved to `~/.notte/cli/current_agent`). All subsequent commands use this agent by default. Use `--agent-id <agent-id>` only when you need to manage multiple agents simultaneously or reference a specific agent.

**Agent ID Resolution:**
1. `--agent-id` flag (highest priority)
2. `NOTTE_AGENT_ID` environment variable
3. `~/.notte/cli/current_agent` file (lowest priority)
notte agents replay

**注意**:启动Agent后,它会自动成为“当前”Agent(保存至`~/.notte/cli/current_agent`)。后续所有命令默认使用该Agent。仅当需要同时管理多个Agent或引用特定Agent时,才使用`--agent-id <agent-id>`参数。

**Agent ID解析顺序**:
1. `--agent-id`参数(优先级最高)
2. `NOTTE_AGENT_ID`环境变量
3. `~/.notte/cli/current_agent`文件(优先级最低)

Functions (Workflow Automation)

函数(工作流自动化)

Create, manage, and schedule reusable workflows:
bash
undefined
创建、管理和调度可复用工作流:
bash
undefined

List all functions (with optional pagination and filters)

列出所有函数(支持可选分页和筛选)

notte functions list [--page N] [--page-size N] [--only-active]
notte functions list [--page N] [--page-size N] [--only-active]

Create a function from a workflow file

从工作流文件创建函数

notte functions create --file workflow.py [--name "My Function"] [--description "..."] [--shared]
notte functions create --file workflow.py [--name "My Function"] [--description "..."] [--shared]

Show current function details

显示当前函数详情

notte functions show
notte functions show

Update current function code

更新当前函数代码

notte functions update --file workflow.py
notte functions update --file workflow.py

Delete current function

删除当前函数

notte functions delete
notte functions delete

Run current function

运行当前函数

notte functions run
notte functions run

List runs for current function (with optional pagination and filters)

列出当前函数的运行记录(支持可选分页和筛选)

notte functions runs [--page N] [--page-size N] [--only-active]
notte functions runs [--page N] [--page-size N] [--only-active]

Stop a running function execution

停止正在运行的函数执行

notte functions run-stop --run-id <run-id>
notte functions run-stop --run-id <run-id>

Get run logs and results

获取运行日志和结果

notte functions run-metadata --run-id <run-id>
notte functions run-metadata --run-id <run-id>

Schedule current function with cron expression

使用Cron表达式调度当前函数

notte functions schedule --cron "0 9 * * *"
notte functions schedule --cron "0 9 * * *"

Remove schedule from current function

取消当前函数的调度

notte functions unschedule
notte functions unschedule

Fork a shared function to your account

复制共享函数到你的账户

notte functions fork --function-id <shared-function-id>

**Note:** When you create a function, it automatically becomes the "current" function. All subsequent commands use this function by default. Use `--function-id <function-id>` only when you need to manage multiple functions simultaneously or reference a specific function (like when forking a shared function).
notte functions fork --function-id <shared-function-id>

**注意**:创建函数后,它会自动成为“当前”函数。后续所有命令默认使用该函数。仅当需要同时管理多个函数或引用特定函数(比如复制共享函数时),才使用`--function-id <function-id>`参数。

Account Management

账户管理

Personas - Auto-generated identities with email:
bash
undefined
Personas - 带邮箱的自动生成身份:
bash
undefined

List personas (with optional pagination and filters)

列出Personas(支持可选分页和筛选)

notte personas list [--page N] [--page-size N] [--only-active]
notte personas list [--page N] [--page-size N] [--only-active]

Create a persona

创建Persona

notte personas create [--create-vault]
notte personas create [--create-vault]

Show persona details

显示Persona详情

notte personas show --persona-id <persona-id>
notte personas show --persona-id <persona-id>

Delete a persona

删除Persona

notte personas delete --persona-id <persona-id>
notte personas delete --persona-id <persona-id>

List emails received by persona

列出Persona收到的邮件

notte personas emails --persona-id <persona-id>
notte personas emails --persona-id <persona-id>

List SMS messages received

列出收到的SMS消息

notte personas sms --persona-id <persona-id>

**Vaults** - Store your own credentials:

```bash
notte personas sms --persona-id <persona-id>

**Vaults** - 存储你自己的凭证:

```bash

List vaults (with optional pagination and filters)

列出Vaults(支持可选分页和筛选)

notte vaults list [--page N] [--page-size N] [--only-active]
notte vaults list [--page N] [--page-size N] [--only-active]

Create a vault

创建Vault

notte vaults create [--name "My Vault"]
notte vaults create [--name "My Vault"]

Update vault name

更新Vault名称

notte vaults update --vault-id <vault-id> --name "New Name"
notte vaults update --vault-id <vault-id> --name "New Name"

Delete a vault

删除Vault

notte vaults delete --vault-id <vault-id>
notte vaults delete --vault-id <vault-id>

Manage credentials

管理凭证

notte vaults credentials list --vault-id <vault-id> notte vaults credentials add --vault-id <vault-id> --url "https://site.com" --password "pass" [--email "..."] [--username "..."] [--mfa-secret "..."] notte vaults credentials get --vault-id <vault-id> --url "https://site.com" notte vaults credentials delete --vault-id <vault-id> --url "https://site.com"
undefined
notte vaults credentials list --vault-id <vault-id> notte vaults credentials add --vault-id <vault-id>
--url "https://site.com"
--password "pass" [--email "..."] [--username "..."] [--mfa-secret "..."] notte vaults credentials get --vault-id <vault-id> --url "https://site.com" notte vaults credentials delete --vault-id <vault-id> --url "https://site.com"
undefined

Global Options

全局选项

Available on all commands:
bash
--output, -o    Output format: text, json (default: text)
--timeout       API request timeout in seconds (default: 30)
--no-color      Disable color output
--verbose, -v   Verbose output
--yes, -y       Skip confirmation prompts
所有命令均支持以下选项:
bash
--output, -o    输出格式:text、json(默认:text)
--timeout       API请求超时时间(秒,默认:30)
--no-color      禁用彩色输出
--verbose, -v   详细输出
--yes, -y       跳过确认提示

Environment Variables

环境变量

VariableDescription
NOTTE_API_KEY
API key for authentication
NOTTE_SESSION_ID
Default session ID (avoids --session-id flag)
NOTTE_API_URL
Custom API endpoint URL
变量名描述
NOTTE_API_KEY
用于身份验证的API密钥
NOTTE_SESSION_ID
默认会话ID(无需使用--session-id参数)
NOTTE_API_URL
自定义API端点URL

Session ID Resolution

会话ID解析顺序

Session ID is resolved in this order:
  1. --session-id
    flag
  2. NOTTE_SESSION_ID
    environment variable
  3. Current session file (set automatically by
    sessions start
    )
会话ID按以下顺序解析:
  1. --session-id
    参数
  2. NOTTE_SESSION_ID
    环境变量
  3. 当前会话文件(由
    sessions start
    自动设置)

Examples

示例

Basic Web Scraping

基础网页爬取

bash
undefined
bash
undefined

Scrape with session

使用会话爬取

notte sessions start --headless notte page goto "https://news.ycombinator.com" notte page scrape --instructions "Extract top 10 story titles" notte sessions stop
notte sessions start --headless notte page goto "https://news.ycombinator.com" notte page scrape --instructions "Extract top 10 story titles" notte sessions stop

Multi-page scraping

多页面爬取

notte sessions start --headless notte page goto "https://example.com/products" notte page observe notte page scrape --instructions "Extract product names and prices" notte page click "@L3" notte page scrape --instructions "Extract product names and prices" notte sessions stop
undefined
notte sessions start --headless notte page goto "https://example.com/products" notte page observe notte page scrape --instructions "Extract product names and prices" notte page click "@L3" notte page scrape --instructions "Extract product names and prices" notte sessions stop
undefined

Form Automation

表单自动化

bash
notte sessions start
notte page goto "https://example.com/signup"
notte page fill "#email-field" "user@example.com"
notte page fill "#password-field" "securepassword"
notte page click "#submit-button"
notte sessions stop
bash
notte sessions start
notte page goto "https://example.com/signup"
notte page fill "#email-field" "user@example.com"
notte page fill "#password-field" "securepassword"
notte page click "#submit-button"
notte sessions stop

Authenticated Session with Vault

带Vault的认证会话

bash
undefined
bash
undefined

Setup credentials once

一次性设置凭证

notte vaults create --name "MyService" notte vaults credentials add --vault-id <vault-id>
--url "https://myservice.com"
--email "me@example.com"
--password "mypassword"
--mfa-secret "JBSWY3DPEHPK3PXP"
notte vaults create --name "MyService" notte vaults credentials add --vault-id <vault-id>
--url "https://myservice.com"
--email "me@example.com"
--password "mypassword"
--mfa-secret "JBSWY3DPEHPK3PXP"

Use in automation (vault credentials auto-fill on matching URLs)

在自动化中使用(匹配URL时自动填充Vault中的凭证)

notte sessions start notte page goto "https://myservice.com/login"
notte sessions start notte page goto "https://myservice.com/login"

Credentials from vault are used automatically

自动使用Vault中的凭证

notte sessions stop
undefined
notte sessions stop
undefined

Scheduled Data Collection

定时数据采集

bash
undefined
bash
undefined

Create workflow file

创建工作流文件

cat > collect_data.py << 'EOF'
cat > collect_data.py << 'EOF'

Notte workflow script

Notte工作流脚本

...

...

EOF
EOF

Upload as function

上传为函数

notte functions create --file collect_data.py --name "Daily Data Collection"
notte functions create --file collect_data.py --name "Daily Data Collection"

Schedule to run every day at 9 AM

调度为每天上午9点运行

notte functions schedule --function-id <function-id> --cron "0 9 * * *"
notte functions schedule --function-id <function-id> --cron "0 9 * * *"

Check run history

查看运行历史

notte functions runs --function-id <function-id>
undefined
notte functions runs --function-id <function-id>
undefined

Tips & Troubleshooting

技巧与故障排除

Handling Inconsistent
observe
Output

处理
observe
输出不一致的问题

The
observe
command may sometimes return stale or partial DOM state, especially with dynamic content, modals, or single-page applications. If the output seems wrong:
  1. Use screenshots to verify:
    notte page screenshot
    always shows the current visual state
  2. Fall back to Playwright selectors: Instead of
    @ID
    references, use standard selectors like
    #id
    ,
    .class
    , or
    button:has-text('Submit')
  3. Add a brief wait:
    notte page wait 500
    before observing can help with dynamic content
observe
命令有时可能返回过时或不完整的DOM状态,尤其是在处理动态内容、模态框或单页应用时。如果输出异常:
  1. 使用截图验证
    notte page screenshot
    始终显示当前视觉状态
  2. ** fallback到Playwright选择器**:如果@ID无效,使用标准选择器如
    #id
    .class
    button:has-text('Submit')
  3. 添加短暂等待:在observe前执行
    notte page wait 500
    可帮助处理动态内容

Selector Syntax

选择器语法

Both element IDs from
observe
and Playwright selectors are supported:
bash
undefined
同时支持
observe
返回的元素ID和Playwright选择器:
bash
undefined

Using element IDs from observe output

使用observe输出的元素ID

notte page click "@B3" notte page fill "@I1" "text"
notte page click "@B3" notte page fill "@I1" "text"

Using Playwright selectors (recommended when @IDs don't work)

使用Playwright选择器(@ID无效时推荐使用)

notte page click "#submit-button" notte page click ".btn-primary" notte page click "button:has-text('Submit')" notte page click "[data-testid='login']" notte page fill "input[name='email']" "user@example.com"

**Handling multiple matches** - Use `>> nth=0` to select the first match:

```bash
notte page click "#submit-button" notte page click ".btn-primary" notte page click "button:has-text('Submit')" notte page click "[data-testid='login']" notte page fill "input[name='email']" "user@example.com"

**处理多个匹配项** - 使用`>> nth=0`选择第一个匹配项:

```bash

When multiple elements match, select by index

当多个元素匹配时,按索引选择

notte page click "button:has-text('OK') >> nth=0" notte page click ".submit-btn >> nth=0"
undefined
notte page click "button:has-text('OK') >> nth=0" notte page click ".submit-btn >> nth=0"
undefined

Working with Modals and Dialogs

处理模态框与对话框

Modals and popups can interfere with page interactions. Tips:
  • Close modals with Escape:
    notte page press "Escape"
    reliably dismisses most dialogs and modals
  • Wait after modal actions: Add
    notte page wait 500
    after closing a modal before the next action
  • Check for overlays: If clicks aren't working, a modal or overlay might be blocking - use screenshot to verify
bash
undefined
模态框和弹出窗口可能会干扰页面交互。技巧:
  • 用Escape关闭模态框
    notte page press "Escape"
    可可靠关闭大多数对话框和模态框
  • 模态框操作后等待:关闭模态框后添加
    notte page wait 500
    再执行下一个操作
  • 检查覆盖层:如果点击无效,可能是模态框或覆盖层阻挡了元素 - 使用截图验证
bash
undefined

Common pattern for handling unexpected modals

处理意外模态框的常见模式

notte page press "Escape" notte page wait 500 notte page click "#target-element"
undefined
notte page press "Escape" notte page wait 500 notte page click "#target-element"
undefined

Viewing Headless Sessions

查看无头会话

Running with
--headless
(the default) doesn't mean you can't see the browser:
  • ViewerUrl: When you start a session, the output includes a
    ViewerUrl
    - open it in your browser to watch the session live
  • Viewer command:
    notte sessions viewer
    opens the viewer directly
  • Non-headless mode: Use
    --headless=false
    only if you need a local browser window (not available on remote/CI environments)
bash
undefined
使用
--headless
模式(默认)并不意味着无法查看浏览器:
  • ViewerUrl:启动会话时,输出会包含一个
    ViewerUrl
    - 在浏览器中打开它即可实时查看会话
  • Viewer命令
    notte sessions viewer
    直接打开查看器
  • 非无头模式:仅当需要本地浏览器窗口时使用
    --headless=false
    (远程/CI环境不可用)
bash
undefined

Start headless session and get viewer URL

启动无头会话并获取查看器URL

notte sessions start -o json | jq -r '.viewer_url'
notte sessions start -o json | jq -r '.viewer_url'

Or open viewer for current session

或为当前会话打开查看器

notte sessions viewer
undefined
notte sessions viewer
undefined

Bot Detection / Stealth

机器人检测 / 隐身模式

If you're getting blocked or seeing CAPTCHAs, try enabling our residential proxies:
bash
notte sessions stop
notte sessions start --proxies
Note: Always stop the current session before starting a new one with different parameters. Session configuration cannot be changed mid-session.
如果你被拦截或遇到验证码,尝试启用我们的住宅代理:
bash
notte sessions stop
notte sessions start --proxies
注意:在使用不同参数启动新会话前,请务必停止当前会话。会话配置无法在会话中途更改。

Additional Resources

额外资源

  • Session Management Reference - Detailed session lifecycle guide
  • Function Management Reference - Workflow automation guide
  • Account Management Reference - Personas and vaults guide
  • 会话管理参考 - 详细的会话生命周期指南
  • 函数管理参考 - 工作流自动化指南
  • 账户管理参考 - Personas和Vaults指南

Templates

模板

Ready-to-use shell script templates:
  • Form Automation - Fill and submit forms
  • Authenticated Session - Login with credential vault
  • Data Extraction - Scrape structured data
即用型Shell脚本模板:
  • 表单自动化 - 填写并提交表单
  • 认证会话 - 使用凭证Vault登录
  • 数据提取 - 爬取结构化数据