> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/documentation/cn/kai-shi-shi-yong/quick-start-agent-browser.md).

# 快速开始：Agent Browser

通过简单的分步指南，只需几分钟即可开始使用 Oxylabs Agent Browser。

{% hint style="success" %}
已经熟悉基础内容？查看 [Agent Browser 文档](/products/cn/agent-browser.md).
{% endhint %}

Oxylabs [Agent Browser](https://oxylabs.io/products/headless-browser) 是一套云托管浏览器基础设施，可自动处理机器人流量控制系统、CAPTCHA 和代理轮换。它与 Playwright、Puppeteer 以及用于 AI 应用的 Model Context Protocol (MCP) 完全兼容。

{% stepper %}
{% step %}

### 设置与凭据

1. **创建账户：** 在以下位置注册： [Oxylabs Dashboard](https://dashboard.oxylabs.io/).
2. **添加产品实例：** 点击 **+ 添加产品实例** 并在浏览器类别中选择 Agent Browser。
3. **设置：** 选择实例名称、产品使用限制（可选），并创建实例。
4. **获取凭据：** 在概览实例表中点击 Agent Browser 产品并获取你的凭据。

{% hint style="info" %}
要免费试用我们的 Agent Browser，请领取 5 美元 [欢迎赠金](/documentation/cn/kong-zhi-mian-ban/ji-yuedu-de-ji-fei.md#free-credits-welcome-credit).
{% endhint %}
{% endstep %}

{% step %}

### 你的第一个请求

Oxylabs Agent Browser 使用 Chrome DevTools Protocol (CDP)。你可以使用 Playwright 或 Puppeteer 连接到它，而无需管理本地浏览器二进制文件。

**Python + Playwright 示例：**

1. 安装 Playwright： `pip install playwright`
2. 运行以下脚本（替换 `USERNAME` 和 `PASSWORD` 为你的凭据）：

```python
from playwright.sync_api import sync_playwright

username = "USERNAME"
password = "PASSWORD"
endpoint = "hb.oxylabs.io"
browser_url = f"wss://{username}:{password}@{endpoint}"

with sync_playwright() as p:
    # Connect to the remote Oxylabs browser
    browser = p.chromium.connect_over_cdp(browser_url)
    page = browser.new_page()
    
    page.goto('https://oxylabs.io/')
    print(f"Page Title: {page.title()}")
    
    browser.close()
```

{% endstep %}
{% endstepper %}

### 自定义浏览器

你也可以通过连接 URL 使用查询参数直接传递指令：

<table><thead><tr><th width="138.5">参数</th><th width="172">示例</th><th>描述</th></tr></thead><tbody><tr><td><code>p_cc</code></td><td><code>?p_cc=US</code></td><td>将浏览器流量路由到特定国家/地区。</td></tr><tr><td><code>p_device</code></td><td><code>?p_device=mobile</code></td><td>模拟特定设备类型。</td></tr><tr><td><code>session_name</code></td><td><code>?session_name=ses-1</code></td><td>创建持久会话，以便让远程浏览器实例在云端持续运行。</td></tr></tbody></table>

在 Agent Browser [文档中查找更多自定义选项](/products/cn/agent-browser.md#features).

### 下一步

* **想监控你的浏览器吗？** 了解 [会话检查工具](/products/cn/agent-browser/session-inspection-and-recording.md) 以可视化方式实时跟踪脚本与浏览器的交互。
* **你的脚本太慢了吗？** 试试 [优化流量](/products/cn/agent-browser.md#recommended-setup) 以阻止不必要的资源加载。这将提高抓取速度并减少带宽消耗。
* **遇到错误或超时？** 访问 [故障排除指南](/products/cn/agent-browser/troubleshooting-guide.md) 以解决常见的 CDP 连接问题、库版本不匹配和执行超时。
* **在大型网站上遇到 "403 Forbidden"？** 查看 [受限目标](/products/cn/agent-browser/restricted-targets.md) 列表，查看哪些网站或服务禁止 Agent Browser 访问。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/documentation/cn/kai-shi-shi-yong/quick-start-agent-browser.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
