Browser Session Capability
Browser Session Capability 方法列表与请求响应合同。
使用绑定解析得到的 baseUrl 和实例 Capability Bearer Token。方法 path 拼接在 baseUrl 后;不发送工作区选择 Header。普通 JSON 响应使用 CModel,必须检查 errorCode;事件流使用 SSE。
协议:HTTP。合同:2.2.1。
方法列表
| 方法 | 用途 | HTTP |
|---|---|---|
| getCatalog | 列出浏览器工具 | GET /browser-sessions/catalog |
| listBrowserProfiles | 列出浏览器配置 | GET /browser-profiles |
| createBrowserProfile | 创建浏览器配置 | POST /browser-profiles |
| setDefaultBrowserProfile | 设置默认配置 | POST /browser-profiles/{profile_id}/default |
| deleteBrowserProfile | 删除配置 | DELETE /browser-profiles/{profile_id} |
| getBrowserProfile | 读取配置 | GET /browser-profiles/{profile_id} |
| listSessions | 列出会话 | GET /browser-sessions |
| createSession | 创建会话 | POST /browser-sessions |
| getSession | 读取会话 | GET /browser-sessions/{session_id} |
| heartbeatSession | 续期会话 | POST /browser-sessions/{session_id}/heartbeat |
| listTabs | 列出标签页 | GET /browser-sessions/{session_id}/tabs |
| createTab | 创建标签页 | POST /browser-sessions/{session_id}/tabs |
| activateTab | 激活标签页 | POST /browser-sessions/{session_id}/tabs/activate |
| closeTab | 关闭标签页 | POST /browser-sessions/{session_id}/tabs/close |
| getCurrentUrl | 读取当前地址 | GET /browser-sessions/{session_id}/current-url |
| navigate | 打开网页 | POST /browser-sessions/{session_id}/navigate |
| screenshot | 截屏 | POST /browser-sessions/{session_id}/screenshot |
| getDom | 读取 DOM | POST /browser-sessions/{session_id}/dom |
| getText | 读取文字 | POST /browser-sessions/{session_id}/text |
| click | 点击元素 | POST /browser-sessions/{session_id}/click |
| typeText | 输入文字 | POST /browser-sessions/{session_id}/type |
| evaluate | 执行 JavaScript | POST /browser-sessions/{session_id}/evaluate |
| getRequestContext | 读取请求上下文 | POST /browser-sessions/{session_id}/request-context |
| closeSession | 关闭会话 | POST /browser-sessions/{session_id}/close |
| listNetworkRequests | 列出网络请求 | GET /browser-sessions/{session_id}/network/requests |
| getNetworkRequest | 读取网络请求 | GET /browser-sessions/{session_id}/network/requests/{request_id} |
| exportNetworkHar | 导出 HAR | GET /browser-sessions/{session_id}/network/har |
| updateNetworkCaptureMode | 设置网络捕获模式 | POST /browser-sessions/{session_id}/network/capture-mode |
| streamRuntimeBindingEvents | 订阅浏览器 Runtime Binding 事件 | GET /browser-sessions/{session_id}/runtime-bindings/{binding_name}/events |
错误码与恢复
普通 JSON 方法使用 CModel 错误模型:HTTP 200 表示响应已正常传输,只有 errorCode: "0" 表示业务成功。调用方按完整错误码处理,不匹配错误文案,也不把 HTTP 200 当作采集成功。SSE 已建立连接后的错误遵循事件流协议,不套用普通 JSON 响应。
当前错误码
以下 13 种错误码由当前服务错误映射使用。retryable 表示原操作是否可在不改变输入、授权或账户状态的情况下重试,不授权自动重放有副作用的点击、脚本或业务提交。生命周期错误详情可包含 sessionId;保留 requestId、traceId(如有)用于排障。
| 错误码 | 触发条件与含义 | retryable | 会话与调用方处理 |
|---|---|---|---|
BROWSER_SESSION_INVALID_REQUEST | 请求参数不合法或缺少必要字段 | false | 修正参数;不因参数错误重建会话或导航 |
BROWSER_SESSION_UNAUTHORIZED | 调用 Browser Session 的 Capability Bearer Token 缺失、无效,或能力实例已停用 | false | 检查绑定与服务调用凭据;不表示第三方网站登录失效,不触发页面导航 |
BROWSER_SESSION_NOT_FOUND | 请求的会话、Profile 或其他资源不存在 | false | 先确定缺失对象;会话不存在且原 Profile 仍有效时可创建新会话,不能把所有资源不存在都当成会话失效 |
BROWSER_SESSION_CONFLICT | 当前资源状态与请求操作冲突 | false | 检查资源状态并解决冲突;不盲目重复创建或重放操作 |
BROWSER_SESSION_STARTING | 会话仍在启动中 | true | 保留原 sessionId,通过 getSession 等待就绪;不要反复创建会话 |
BROWSER_SESSION_NOT_READY | 会话尚不具备执行浏览器操作的条件 | true | 查询状态,等待就绪后再请求;此错误本身不证明会话已终止 |
BROWSER_SESSION_STARTUP_FAILED | 会话启动失败,启动重试已耗尽 | false | 原会话不可继续使用;查看失败原因,由调用方显式重试打开 |
BROWSER_SESSION_TERMINATED | 已运行的浏览器宿主终止,或会话绑定的 Chrome 运行实例已变化 | false | 放弃旧会话,在原 Profile 下创建新会话并重新初始化业务页面;不能原样重试旧会话 |
BROWSER_SESSION_CLOSED | 会话已关闭 | false | 旧会话不可恢复;需要继续操作时创建新会话 |
BROWSER_SESSION_EXPIRED | 会话超过空闲期限,或已因过期而关闭 | false | 旧会话不可恢复;使用原 Profile 创建新会话,重新初始化业务页面 |
BROWSER_SESSION_CONNECTION_FAILED | 暂时无法连接浏览器,或调用链存在连接故障 | true | 保留会话,稍后查询或重试;连接失败本身不能证明浏览器已重启 |
BROWSER_SESSION_PAGE_RESET | 同一 Chrome 实例内活动页面丢失,服务已恢复页面并更新活动目标 | false | 保留 sessionId,重新导航和初始化业务页面;原操作不会自动重放 |
BROWSER_SESSION_INTERNAL_ERROR | 未被明确分类的服务内部或浏览器操作错误 | false | 保留请求标识并排查;不能仅凭此码自动创建 Tab、重建会话或重放业务操作 |
BROWSER_SESSION_UPSTREAM_UNAVAILABLE 已登记(retryable: true),但当前服务错误映射未使用。它表示浏览器运行环境暂不可用;调用方不能依赖当前实现一定会返回此码,也不能把它当成会话已终止。
getSession 还可能成功返回一个带生命周期 status 和 error 的会话对象。调用方既要检查外层 CModel,也要检查返回的会话状态:状态查询成功不代表会话已经可执行操作。starting 应等待,failed 应读取具体失败原因,不能把所有失败状态解释为启动失败。
方法适用范围
错误以实际执行阶段为准;下表帮助调用方选择恢复路径,不保证每次失败都能归入某个特定生命周期错误。方法参数和成功结果继续以下方合同为准。
| 方法 | 应关注的失败与处理 |
|---|---|
| 所有普通 JSON 方法 | 调用认证失败、参数错误及内部错误;先检查 CModel,再读取成功数据 |
getCatalog、listBrowserProfiles、listSessions | 读取目录或列表;不要因列表失败执行页面导航 |
createBrowserProfile、setDefaultBrowserProfile、deleteBrowserProfile、getBrowserProfile | Profile 不存在、参数或状态冲突;Profile 管理错误不等于某个 Tab 丢失 |
createSession | Profile、参数或状态错误;返回会话后继续根据 starting / live / failed 状态判断结果 |
getSession | 会话不存在,或成功响应中的生命周期状态与失败原因;按上表选择等待或新建会话 |
heartbeatSession、listTabs、createTab、activateTab、closeTab、getCurrentUrl、navigate、screenshot、getDom、getText、click、typeText、evaluate、getRequestContext、updateNetworkCaptureMode | 使用运行中的会话,需处理生命周期及连接错误;页面操作还需处理 BROWSER_SESSION_PAGE_RESET;内部错误不能证明某个业务动作未执行 |
listNetworkRequests、getNetworkRequest、exportNetworkHar | 读取记录时的资源、参数及内部错误;历史记录读取成功不证明浏览器仍存活 |
closeSession | 关闭操作中的资源、状态和内部错误;失败后查询状态,不把重复关闭当成业务恢复 |
streamRuntimeBindingEvents | 建立连接前检查认证和会话状态;建立 SSE 连接后按事件流协议处理断开和事件 |
Browser Session 管理内部 Tab。活动页面丢失并恢复后返回 BROWSER_SESSION_PAGE_RESET;显式请求不存在的非活动 Tab 属于 BROWSER_SESSION_INVALID_REQUEST。调用方不得解析 No target with given id found 等内部文案来驱动恢复。
失败响应示例
以下示例表示旧会话已过期,调用方应建立新会话,而不是重复向旧会话发送导航请求:
{
"contractVersion": "1.0.0",
"errorCode": "BROWSER_SESSION_EXPIRED",
"data": {
"message": "浏览器会话已过期,请重新打开",
"retryable": false,
"sessionId": "bs_example"
}
}页面重置契约
Browser Session 8.1.0 起提供 BROWSER_SESSION_PAGE_RESET。美团浏览器 0.8.7 已接入:页面导航和签名环境准备阶段收到此码,会重新准备一次;已经开始的业务请求不会自动重放。
该错误只在服务确认仍是同一 Chrome 运行实例、原页面目标不存在,并成功恢复可操作的空白页面、更新内部活动目标后返回。原业务 sessionId 保留,本次操作未得到成功结果,不会在新页面上自动重放。只有恢复成功才能返回此码;连接或创建页面失败必须返回相应失败。
{
"contractVersion": "1.0.0",
"errorCode": "BROWSER_SESSION_PAGE_RESET",
"data": {
"message": "浏览器页面已重置,请重新初始化页面后再试",
"retryable": false,
"sessionId": "bs_example"
}
}调用方收到后应重新导航业务入口,检查登录及业务页面就绪条件,再决定是否重新发起业务请求。retryable: false 表示不能原样重试本次操作;恢复页面后重新发起只读采集属于新的业务执行。已经发起的写操作必须先核实结果或依靠业务幂等契约,不能自动重放。
职责边界:Browser Session 管理浏览器连接、内部 Tab 与页面恢复,不判断第三方网站登录、签名 SDK、门店等业务状态;业务模块负责页面导航和业务初始化,网页前端只展示恢复进度或需要用户处理的登录动作。并发旧页面请求应共用一次页面恢复,业务模块也应合并同一业务上下文的初始化,避免互相覆盖。
会话与浏览器重启
Browser Session 8.1.1 起,sessionId 绑定一次 Chrome 运行实例。服务使用 CDP 的浏览器级标识判定实例,调用方只需处理 sessionId 和标准错误,无需同步容器编号或内部 Tab 标识。
- Chrome 因 OOM、崩溃或重启更换实例:旧会话返回
BROWSER_SESSION_TERMINATED。在同一 Profile 下创建新会话,获得新的sessionId,重新导航并准备业务页面。 - Chrome 未重启,仅活动 Tab 丢失:服务恢复页面后返回
BROWSER_SESSION_PAGE_RESET,保留sessionId,调用方重新准备业务页面。 - 暂时断连或无法确认浏览器身份:返回连接失败,不能据此认定重启并不断创建新会话。
服务在建立 CDP 连接和连接重试时检查绑定;标签页查询、页面操作、网络录制及 Runtime binding 流都不能跨实例继续执行。已建立的流断开后结束,调用方通过会话状态判断下一步。current-url 是当前页面的实时查询结果,不承担会话身份同步。
升级前缺少实例绑定的旧会话不能直接认领当前 Chrome,使用时会被判定失效,需要通过原 Profile 创建新会话。Profile 中持久化的数据保留;页面内存状态需要重新初始化。调用方应按 Profile 保存当前 sessionId,只清理与失败旧 sessionId 匹配的业务状态,避免迟到请求覆盖新会话。已经开始的业务操作不得自动重放。
getCatalog
列出浏览器工具
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/catalog
{
"operationId": "getCatalog",
"summary": "列出浏览器工具",
"description": "列出浏览器工具",
"parameters": [],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserSessionCatalogResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}listBrowserProfiles
列出浏览器配置
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-profiles
{
"operationId": "listBrowserProfiles",
"summary": "列出浏览器配置",
"description": "列出浏览器配置",
"parameters": [],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BrowserProfileResponse"
}
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}createBrowserProfile
创建浏览器配置
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-profiles
{
"operationId": "createBrowserProfile",
"summary": "创建浏览器配置",
"description": "创建浏览器配置",
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserProfileResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateBrowserProfileRequest"
}
}
}
}
}setDefaultBrowserProfile
设置默认配置
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-profiles/{profile_id}/default
{
"operationId": "setDefaultBrowserProfile",
"summary": "设置默认配置",
"description": "设置默认配置",
"parameters": [
{
"name": "profile_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserProfileResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}deleteBrowserProfile
删除配置
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
DELETE /browser-profiles/{profile_id}
{
"operationId": "deleteBrowserProfile",
"summary": "删除配置",
"description": "删除配置",
"parameters": [
{
"name": "profile_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"type": "boolean"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}getBrowserProfile
读取配置
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-profiles/{profile_id}
{
"operationId": "getBrowserProfile",
"summary": "读取配置",
"description": "读取配置",
"parameters": [
{
"name": "profile_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserProfileResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}listSessions
列出会话
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions
{
"operationId": "listSessions",
"summary": "列出会话",
"description": "列出会话",
"parameters": [],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BrowserSessionResponse"
}
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}createSession
创建会话
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions
{
"operationId": "createSession",
"summary": "创建会话",
"description": "创建会话",
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserSessionResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateBrowserSessionRequest"
}
}
}
}
}getSession
读取会话
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}
{
"operationId": "getSession",
"summary": "读取会话",
"description": "读取会话",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserSessionResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}heartbeatSession
续期会话
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/heartbeat
{
"operationId": "heartbeatSession",
"summary": "续期会话",
"description": "续期会话",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/SessionHeartbeatResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}listTabs
列出标签页
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}/tabs
{
"operationId": "listTabs",
"summary": "列出标签页",
"description": "列出标签页",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserTabListResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}createTab
创建标签页
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/tabs
{
"operationId": "createTab",
"summary": "创建标签页",
"description": "创建标签页",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserTabInfo"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTabRequest"
}
}
}
}
}activateTab
激活标签页
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/tabs/activate
{
"operationId": "activateTab",
"summary": "激活标签页",
"description": "激活标签页",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserTabInfo"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TabActionRequest"
}
}
}
}
}closeTab
关闭标签页
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/tabs/close
{
"operationId": "closeTab",
"summary": "关闭标签页",
"description": "关闭标签页",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserTabInfo"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TabActionRequest"
}
}
}
}
}getCurrentUrl
读取当前地址
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}/current-url
{
"operationId": "getCurrentUrl",
"summary": "读取当前地址",
"description": "读取当前地址",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/CurrentUrlResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}navigate
打开网页
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/navigate
{
"operationId": "navigate",
"summary": "打开网页",
"description": "打开网页",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/NavigateResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NavigateRequest"
}
}
}
}
}screenshot
截屏
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/screenshot
{
"operationId": "screenshot",
"summary": "截屏",
"description": "截屏",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/ScreenshotResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}getDom
读取 DOM
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/dom
{
"operationId": "getDom",
"summary": "读取 DOM",
"description": "读取 DOM",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/DomResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetDomRequest"
}
}
}
}
}getText
读取文字
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/text
{
"operationId": "getText",
"summary": "读取文字",
"description": "读取文字",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/TextResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetTextRequest"
}
}
}
}
}click
点击元素
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/click
{
"operationId": "click",
"summary": "点击元素",
"description": "点击元素",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/ActionResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClickRequest"
}
}
}
}
}typeText
输入文字
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/type
{
"operationId": "typeText",
"summary": "输入文字",
"description": "输入文字",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/ActionResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TypeRequest"
}
}
}
}
}evaluate
执行 JavaScript
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/evaluate
{
"operationId": "evaluate",
"summary": "执行 JavaScript",
"description": "执行 JavaScript",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/EvaluateResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EvaluateRequest"
}
}
}
}
}getRequestContext
读取请求上下文
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/request-context
{
"operationId": "getRequestContext",
"summary": "读取请求上下文",
"description": "读取请求上下文",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserRequestContextResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BrowserRequestContextRequest"
}
}
}
}
}closeSession
关闭会话
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/close
{
"operationId": "closeSession",
"summary": "关闭会话",
"description": "关闭会话",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserSessionResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}listNetworkRequests
列出网络请求
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}/network/requests
{
"operationId": "listNetworkRequests",
"summary": "列出网络请求",
"description": "列出网络请求",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "resourceType",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
{
"name": "resourceTypes",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
{
"name": "method",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
{
"name": "status",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
}
},
{
"name": "mimeType",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
{
"name": "urlContains",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
{
"name": "onlyJson",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
},
{
"name": "excludeStatic",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
},
{
"name": "onlyWithResponseBody",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/NetworkRequestListResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}getNetworkRequest
读取网络请求
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}/network/requests/{request_id}
{
"operationId": "getNetworkRequest",
"summary": "读取网络请求",
"description": "读取网络请求",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "request_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/NetworkRequestDetailResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}exportNetworkHar
导出 HAR
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}/network/har
{
"operationId": "exportNetworkHar",
"summary": "导出 HAR",
"description": "导出 HAR",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/HarResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}updateNetworkCaptureMode
设置网络捕获模式
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
POST /browser-sessions/{session_id}/network/capture-mode
{
"operationId": "updateNetworkCaptureMode",
"summary": "设置网络捕获模式",
"description": "设置网络捕获模式",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "成功响应",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"const": "0"
},
"data": {
"$ref": "#/components/schemas/BrowserSessionResponse"
}
}
},
{
"type": "object",
"required": [
"contractVersion",
"errorCode",
"data"
],
"properties": {
"contractVersion": {
"type": "string"
},
"errorCode": {
"type": "string",
"not": {
"const": "0"
}
},
"data": {
"type": "object",
"description": "CModelFailureData,包含用户可读错误和 retryable;保留 requestId 用于排障。"
}
}
}
]
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateNetworkCaptureRequest"
}
}
}
}
}streamRuntimeBindingEvents
订阅浏览器 Runtime Binding 事件
错误与调用方处理见本页“错误码与恢复”及“方法适用范围”。
GET /browser-sessions/{session_id}/runtime-bindings/{binding_name}/events
{
"operationId": "streamRuntimeBindingEvents",
"summary": "订阅浏览器 Runtime Binding 事件",
"description": "订阅浏览器 Runtime Binding 事件",
"parameters": [
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "binding_name",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "SSE:binding-ready、binding-called、stream-error;每个 data 为事件 JSON。连接关闭不代表浏览器会话关闭。",
"content": {
"text/event-stream": {
"schema": {
"type": "string"
}
}
}
}
},
"security": [
{
"capabilityToken": []
}
]
}Schema 定义
所有 $ref 引用均来自同一提供方合同的 components。
{
"securitySchemes": {
"capabilityToken": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"BrowserSessionCatalogResponse": {
"type": "object",
"properties": {
"tools": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BrowserSessionCatalogItem"
}
}
},
"required": [
"tools"
]
},
"BrowserSessionCatalogItem": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"label": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"key",
"label",
"description"
]
},
"BrowserProfileResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"browserType": {
"type": "string"
},
"status": {
"type": "string"
},
"isDefault": {
"type": "boolean"
},
"lastUsedAt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"createTime": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"updateTime": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"name",
"browserType",
"status",
"isDefault"
]
},
"CreateBrowserProfileRequest": {
"type": "object",
"properties": {
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"setAsDefault": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
},
"required": []
},
"BrowserSessionResponse": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
},
"profileId": {
"type": "string"
},
"status": {
"$ref": "#/components/schemas/BrowserSessionStatus"
},
"deploymentId": {
"type": "string"
},
"deploymentStatus": {
"type": "string"
},
"containerId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"viewerUrl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"rawVncUrl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"cdpUrl": {
"type": "string"
},
"hostId": {
"type": "string"
},
"containerName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"profilePath": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"startUrl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"persistProfile": {
"type": "boolean"
},
"networkCaptureMode": {
"$ref": "#/components/schemas/NetworkCaptureMode"
},
"createdAt": {
"type": "string"
},
"lastActivityAt": {
"type": "string"
},
"expiresAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"metadata": {
"$ref": "#/components/schemas/BrowserSessionMetadata"
},
"error": {
"anyOf": [
{
"$ref": "#/components/schemas/BrowserSessionStartupError"
},
{
"type": "null"
}
]
}
},
"required": [
"sessionId",
"profileId",
"status",
"deploymentId",
"deploymentStatus",
"cdpUrl",
"hostId",
"persistProfile",
"networkCaptureMode",
"createdAt",
"lastActivityAt",
"expiresAt",
"updatedAt",
"metadata"
]
},
"BrowserSessionStatus": {
"oneOf": [
{
"const": "starting"
},
{
"const": "live"
},
{
"const": "failed"
},
{
"const": "closed"
}
]
},
"NetworkCaptureMode": {
"oneOf": [
{
"const": "off"
},
{
"const": "metadata"
},
{
"const": "full"
}
]
},
"BrowserSessionMetadata": {
"type": "object",
"properties": {
"customerId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"instanceId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"note": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"activeTargetId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"mode": {
"anyOf": [
{
"$ref": "#/components/schemas/BrowserSessionMode"
},
{
"type": "null"
}
]
}
},
"required": []
},
"BrowserSessionMode": {
"oneOf": [
{
"const": "visible"
},
{
"const": "headless"
}
]
},
"BrowserSessionStartupError": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"retryable": {
"type": "boolean"
}
},
"required": [
"code",
"message",
"retryable"
]
},
"CreateBrowserSessionRequest": {
"type": "object",
"properties": {
"profileId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"startUrl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"captureMode": {
"anyOf": [
{
"$ref": "#/components/schemas/NetworkCaptureMode"
},
{
"type": "null"
}
]
},
"mode": {
"anyOf": [
{
"$ref": "#/components/schemas/BrowserSessionMode"
},
{
"type": "null"
}
]
}
},
"required": []
},
"SessionHeartbeatResponse": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
},
"lastActivityAt": {
"type": "string"
},
"expiresAt": {
"type": "string"
}
},
"required": [
"sessionId",
"lastActivityAt",
"expiresAt"
]
},
"BrowserTabListResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BrowserTabInfo"
}
}
},
"required": [
"items"
]
},
"BrowserTabInfo": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
},
"type": {
"type": "string"
},
"active": {
"type": "boolean"
}
},
"required": [
"id",
"title",
"url",
"type",
"active"
]
},
"CreateTabRequest": {
"type": "object",
"properties": {
"url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"activate": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
},
"required": []
},
"TabActionRequest": {
"type": "object",
"properties": {
"targetId": {
"type": "string"
}
},
"required": [
"targetId"
]
},
"CurrentUrlResponse": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"required": [
"url"
]
},
"NavigateRequest": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"targetId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"url"
]
},
"NavigateResponse": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"required": [
"url"
]
},
"ScreenshotResponse": {
"type": "object",
"properties": {
"data": {
"type": "string"
}
},
"required": [
"data"
]
},
"GetDomRequest": {
"type": "object",
"properties": {
"selector": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"mode": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": []
},
"DomResponse": {
"type": "object",
"properties": {
"selector": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"mode": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"mode",
"value"
]
},
"GetTextRequest": {
"type": "object",
"properties": {
"selector": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": []
},
"TextResponse": {
"type": "object",
"properties": {
"selector": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"value": {
"type": "string"
}
},
"required": [
"value"
]
},
"ClickRequest": {
"type": "object",
"properties": {
"selector": {
"type": "string"
}
},
"required": [
"selector"
]
},
"ActionResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
},
"required": [
"ok"
]
},
"TypeRequest": {
"type": "object",
"properties": {
"selector": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"selector",
"text"
]
},
"EvaluateRequest": {
"type": "object",
"properties": {
"script": {
"type": "string"
}
},
"required": [
"script"
]
},
"EvaluateResponse": {
"anyOf": [
{
"type": "object",
"properties": {
"value": {}
},
"required": [
"value"
]
},
{}
]
},
"BrowserRequestContextRequest": {
"type": "object",
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"urls"
]
},
"BrowserRequestContextResponse": {
"type": "object",
"properties": {
"cookieHeader": {
"type": "string"
},
"cookieNames": {
"type": "array",
"items": {
"type": "string"
}
},
"userAgent": {
"type": "string"
}
},
"required": [
"cookieHeader",
"cookieNames",
"userAgent"
]
},
"NetworkRequestListResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CapturedNetworkRequestSummary"
}
}
},
"required": [
"items"
]
},
"CapturedNetworkRequestSummary": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"cdpRequestId": {
"type": "string"
},
"targetId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"resourceType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"method": {
"type": "string"
},
"url": {
"type": "string"
},
"responseStatus": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
},
"mimeType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"encodedDataLength": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"hasRequestCookies": {
"type": "boolean"
},
"hasRequestBody": {
"type": "boolean"
},
"hasResponseBody": {
"type": "boolean"
},
"responseBodyBase64Encoded": {
"type": "boolean"
},
"startedAt": {
"type": "string"
},
"finishedAt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"cdpRequestId",
"method",
"url",
"hasRequestCookies",
"hasRequestBody",
"hasResponseBody",
"responseBodyBase64Encoded",
"startedAt"
]
},
"NetworkRequestListQuery": {
"type": "object",
"properties": {
"resourceType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"resourceTypes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"method": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"status": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
},
"mimeType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"urlContains": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"onlyJson": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"excludeStatic": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"onlyWithResponseBody": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"limit": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
}
},
"required": []
},
"NetworkRequestDetailResponse": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/CapturedNetworkRequest"
}
},
"required": [
"item"
]
},
"CapturedNetworkRequest": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"cdpRequestId": {
"type": "string"
},
"targetId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"resourceType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"method": {
"type": "string"
},
"url": {
"type": "string"
},
"mimeType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"requestHeaders": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HeaderPair"
}
},
"requestCookies": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CapturedNetworkCookie"
}
},
"requestBody": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"responseStatus": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "null"
}
]
},
"responseHeaders": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HeaderPair"
}
},
"responseBody": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"responseBodyBase64Encoded": {
"type": "boolean"
},
"encodedDataLength": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"startedAt": {
"type": "string"
},
"finishedAt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"cdpRequestId",
"method",
"url",
"requestHeaders",
"requestCookies",
"responseHeaders",
"responseBodyBase64Encoded",
"startedAt"
]
},
"HeaderPair": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
]
},
"CapturedNetworkCookie": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"domain": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"expires": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"httpOnly": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"secure": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"sameSite": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"name",
"value"
]
},
"HarResponse": {
"type": "object",
"properties": {
"log": {
"$ref": "#/components/schemas/HarLog"
}
},
"required": [
"log"
]
},
"HarLog": {
"type": "object",
"properties": {
"version": {
"type": "string"
},
"creator": {
"$ref": "#/components/schemas/HarCreator"
},
"browser": {
"anyOf": [
{
"$ref": "#/components/schemas/HarCreator"
},
{
"type": "null"
}
]
},
"pages": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarPage"
}
},
"entries": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarEntry"
}
}
},
"required": [
"version",
"creator",
"pages",
"entries"
]
},
"HarCreator": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"name",
"version"
]
},
"HarPage": {
"type": "object",
"properties": {
"startedDateTime": {
"type": "string"
},
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"pageTimings": {
"$ref": "#/components/schemas/HarPageTimings"
}
},
"required": [
"startedDateTime",
"id",
"title",
"pageTimings"
]
},
"HarPageTimings": {
"type": "object",
"properties": {
"onContentLoad": {
"type": "integer"
},
"onLoad": {
"type": "integer"
}
},
"required": [
"onContentLoad",
"onLoad"
]
},
"HarEntry": {
"type": "object",
"properties": {
"pageref": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"startedDateTime": {
"type": "string"
},
"time": {
"type": "number"
},
"request": {
"$ref": "#/components/schemas/HarRequest"
},
"response": {
"$ref": "#/components/schemas/HarResponseData"
},
"cache": {},
"timings": {
"$ref": "#/components/schemas/HarTimings"
},
"serverIpAddress": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"connection": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"comment": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"startedDateTime",
"time",
"request",
"response",
"cache",
"timings"
]
},
"HarRequest": {
"type": "object",
"properties": {
"method": {
"type": "string"
},
"url": {
"type": "string"
},
"httpVersion": {
"type": "string"
},
"cookies": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarCookie"
}
},
"headers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarHeader"
}
},
"queryString": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarQueryParam"
}
},
"postData": {
"anyOf": [
{
"$ref": "#/components/schemas/HarPostData"
},
{
"type": "null"
}
]
},
"headersSize": {
"type": "integer"
},
"bodySize": {
"type": "integer"
}
},
"required": [
"method",
"url",
"httpVersion",
"cookies",
"headers",
"queryString",
"headersSize",
"bodySize"
]
},
"HarCookie": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
]
},
"HarHeader": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
]
},
"HarQueryParam": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
]
},
"HarPostData": {
"type": "object",
"properties": {
"mimeType": {
"type": "string"
},
"text": {
"type": "string"
},
"params": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarQueryParam"
}
}
},
"required": [
"mimeType",
"text",
"params"
]
},
"HarResponseData": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"statusText": {
"type": "string"
},
"httpVersion": {
"type": "string"
},
"cookies": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarCookie"
}
},
"headers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HarHeader"
}
},
"content": {
"$ref": "#/components/schemas/HarContent"
},
"redirectUrl": {
"type": "string"
},
"headersSize": {
"type": "integer"
},
"bodySize": {
"type": "integer"
}
},
"required": [
"status",
"statusText",
"httpVersion",
"cookies",
"headers",
"content",
"redirectUrl",
"headersSize",
"bodySize"
]
},
"HarContent": {
"type": "object",
"properties": {
"size": {
"type": "integer"
},
"mimeType": {
"type": "string"
},
"text": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"size",
"mimeType"
]
},
"HarTimings": {
"type": "object",
"properties": {
"blocked": {
"type": "number"
},
"dns": {
"type": "number"
},
"connect": {
"type": "number"
},
"send": {
"type": "number"
},
"wait": {
"type": "number"
},
"receive": {
"type": "number"
},
"ssl": {
"type": "number"
}
},
"required": [
"blocked",
"dns",
"connect",
"send",
"wait",
"receive",
"ssl"
]
},
"UpdateNetworkCaptureRequest": {
"type": "object",
"properties": {
"captureMode": {
"$ref": "#/components/schemas/NetworkCaptureMode"
}
},
"required": [
"captureMode"
]
}
}
}