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驱动的网页交互。
2. Start a browser session
2. 启动浏览器会话
3. Navigate and observe
3. 导航与查看
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')"
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. 停止会话
Control browser session lifecycle:
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
获取当前会话状态
Stop current session
停止当前会话
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 replay URL/data
获取回放URL/数据
Export session steps as Python workflow code
将会话步骤导出为Python工作流代码
notte sessions workflow-code
Cookie management:
```bash
notte sessions workflow-code
Get all cookies
获取所有Cookie
Set cookies from JSON file
从JSON文件设置Cookie
notte sessions cookies-set --file cookies.json
notte sessions cookies-set --file cookies.json
Simplified commands for page interactions:
Element Interactions:
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 点击后按回车键
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.
- 如有需要,转义单引号。
- 不要使用日志(输出不会被捕获)。
- 使用单个表达式或带返回值的函数。
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:
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
页面状态:
Observe page state and available actions
查看页面状态和可用操作
Save a screenshot in tmp folder
在临时文件夹保存截图
Scrape content with instructions
根据指令爬取内容
notte page scrape --instructions "Extract all links" [--only-main-content]
notte page scrape --instructions "Extract all links" [--only-main-content]
Wait for specified duration
等待指定时长
notte page captcha-solve "recaptcha"
notte page captcha-solve "recaptcha"
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"}'
notte page form-fill --data '{"email": "test@example.com", "name": "John"}'
Start and manage AI-powered browser agents:
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状态
Stop current agent
停止当前Agent
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:
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
显示当前函数详情
Update current function code
更新当前函数代码
notte functions update --file workflow.py
notte functions update --file workflow.py
Delete current function
删除当前函数
Run current function
运行当前函数
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>`参数。
Personas - Auto-generated identities with email:
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]
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"
notte vaults delete --vault-id <vault-id>
notte vaults delete --vault-id <vault-id>
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"
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"
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
环境变量
| Variable | Description |
|---|
| API key for authentication |
| Default session ID (avoids --session-id flag) |
| Custom API endpoint URL |
| 变量名 | 描述 |
|---|
| 用于身份验证的API密钥 |
| 默认会话ID(无需使用--session-id参数) |
| 自定义API端点URL |
Session ID Resolution
会话ID解析顺序
Session ID is resolved in this order:
- flag
- environment variable
- Current session file (set automatically by )
会话ID按以下顺序解析:
- 参数
- 环境变量
- 当前会话文件(由自动设置)
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
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
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
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的认证会话
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中的凭证)
Credentials from vault are used automatically
自动使用Vault中的凭证
Scheduled Data Collection
定时数据采集
Create workflow file
创建工作流文件
cat > collect_data.py << 'EOF'
cat > collect_data.py << 'EOF'
Notte workflow script
Notte工作流脚本
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 * * *"
notte functions runs --function-id <function-id>
notte functions runs --function-id <function-id>
Tips & Troubleshooting
技巧与故障排除
Handling Inconsistent Output
The
command may sometimes return stale or partial DOM state, especially with dynamic content, modals, or single-page applications. If the output seems wrong:
- Use screenshots to verify: always shows the current visual state
- Fall back to Playwright selectors: Instead of references, use standard selectors like , , or
button:has-text('Submit')
- Add a brief wait: before observing can help with dynamic content
命令有时可能返回过时或不完整的DOM状态,尤其是在处理动态内容、模态框或单页应用时。如果输出异常:
- 使用截图验证:始终显示当前视觉状态
- ** fallback到Playwright选择器**:如果@ID无效,使用标准选择器如、或
button:has-text('Submit')
- 添加短暂等待:在observe前执行可帮助处理动态内容
Both element IDs from
and Playwright selectors are supported:
同时支持
返回的元素ID和Playwright选择器:
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"
notte page click "button:has-text('OK') >> nth=0"
notte page click ".submit-btn >> nth=0"
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 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
模态框和弹出窗口可能会干扰页面交互。技巧:
- 用Escape关闭模态框:
notte page press "Escape"
可可靠关闭大多数对话框和模态框
- 模态框操作后等待:关闭模态框后添加再执行下一个操作
- 检查覆盖层:如果点击无效,可能是模态框或覆盖层阻挡了元素 - 使用截图验证
Common pattern for handling unexpected modals
处理意外模态框的常见模式
notte page press "Escape"
notte page wait 500
notte page click "#target-element"
notte page press "Escape"
notte page wait 500
notte page click "#target-element"
Viewing Headless Sessions
查看无头会话
Running with
(the default) doesn't mean you can't see the browser:
- ViewerUrl: When you start a session, the output includes a - open it in your browser to watch the session live
- Viewer command: opens the viewer directly
- Non-headless mode: Use only if you need a local browser window (not available on remote/CI environments)
- ViewerUrl:启动会话时,输出会包含一个 - 在浏览器中打开它即可实时查看会话
- Viewer命令:直接打开查看器
- 非无头模式:仅当需要本地浏览器窗口时使用(远程/CI环境不可用)
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
或为当前会话打开查看器
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
注意:在使用不同参数启动新会话前,请务必停止当前会话。会话配置无法在会话中途更改。
- Session Management Reference - Detailed session lifecycle guide
- Function Management Reference - Workflow automation guide
- Account Management Reference - Personas and vaults guide
- 会话管理参考 - 详细的会话生命周期指南
- 函数管理参考 - 工作流自动化指南
- 账户管理参考 - Personas和Vaults指南
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登录
- 数据提取 - 爬取结构化数据