Browser Sessions - Get
为指定的会话和工作区ID创建一个浏览器会话。 需要 Entra ID 提供的不记名 JWT 访问令牌。
GET {endpoint}/playwrightworkspaces/{workspaceId}/browser-sessions/{sessionId}?api-version=2026-04-01-preview
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
Playwright 服务 API 端点(协议和主机名)格式为 https://{region}.api.playwright.microsoft.com。
该区域对应于 Azure Playwright 工作区位置。 可以在 的 Azure Playwright 工作区属性 |
|
session
|
path | True |
string minLength: 3maxLength: 36 pattern: [A-Za-z0-9]+(-[A-Za-z0-9]+)+ |
浏览器会话ID格式为GUID格式。 |
|
workspace
|
path | True |
string minLength: 3maxLength: 36 pattern: [A-Za-z0-9]+(-[A-Za-z0-9]+)+ |
GUID 格式的工作区 ID。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
请求头
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| x-ms-client-request-id |
string (uuid) |
请求的不透明、全局唯一的客户端生成的字符串标识符。 |
|
| x-ms-useragent |
string |
可选头部用于在无法显式设置标准“User-Agent”头部时指定额外客户端信息,例如使用Playwright Client时。 该值应遵循标准的“User-Agent”头格式。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
请求已成功。 标头 x-ms-client-request-id: string |
|
| Other Status Codes |
意外的错误响应。 标头 x-ms-error-code: string |
安全性
OAuth2Auth
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| https://playwright.microsoft.com/.default |
示例
BrowserSessions_Get
示例请求
GET {endpoint}/playwrightworkspaces/00000000-0000-0000-0000-000000000000/browser-sessions/00000000-0000-0000-0000-000000000000?api-version=2026-04-01-preview
示例响应
{
"id": "00000000-0000-0000-0000-000000000000",
"displayName": "<BrowserSession_Timestamp>",
"creatorId": "string",
"source": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "PlaywrightWorkspacesTestRun"
},
"startTime": "2025-06-06T11:43:28.954Z",
"endTime": "2025-06-06T11:43:28.954Z",
"durationInMilliseconds": 0,
"status": "Created",
"browserType": "Chromium",
"operatingSystem": "Windows"
}
定义
| 名称 | 说明 |
|---|---|
|
Azure. |
错误对象。 |
|
Azure. |
包含错误详细信息的响应。 |
|
Azure. |
包含有关错误的更具体信息的对象。 根据 Azure REST API 指南 - https://aka.ms/AzureRestApiGuidelines#handling-errors。 |
|
Browser |
用于跟踪目的的浏览器会话模型。 |
|
Browser |
浏览器会话源的详细信息。 |
|
Browser |
浏览器会话源类型。 |
|
Browser |
浏览器会话状态。 |
|
Browser |
用于配置远程脚本执行的浏览器类型。 |
| OS |
该操作系统配置远程脚本执行。 |
Azure.Core.Foundations.Error
错误对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| details |
导致此报告错误的特定错误的详细信息数组。 |
|
| innererror |
包含与当前对象有关错误的更具体信息的对象。 |
|
| message |
string |
错误的人工可读表示形式。 |
| target |
string |
错误的目标。 |
Azure.Core.Foundations.ErrorResponse
包含错误详细信息的响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
Azure.Core.Foundations.InnerError
包含有关错误的更具体信息的对象。 根据 Azure REST API 指南 - https://aka.ms/AzureRestApiGuidelines#handling-errors。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| innererror |
内部错误。 |
BrowserSession
用于跟踪目的的浏览器会话模型。
| 名称 | 类型 | 说明 |
|---|---|---|
| browserType |
浏览器会话浏览器类型。 |
|
| creatorId |
string |
浏览器会话创建者的ID。 |
| displayName |
string minLength: 1maxLength: 200 |
浏览器会话显示名称。 |
| durationInMilliseconds |
integer (int64) |
浏览器会话时长以毫秒计。 |
| endTime |
string (date-time) |
浏览器会话结束时间为UTC。 |
| id |
string minLength: 3maxLength: 36 pattern: [A-Za-z0-9]+(-[A-Za-z0-9]+)+ |
浏览器会话ID格式为GUID格式。 |
| operatingSystem |
浏览器会话操作系统。 |
|
| source |
浏览器会话源的详细信息。 |
|
| startTime |
string (date-time) |
浏览器会话开始时间为UTC。 |
| status |
浏览器会话状态。 |
BrowserSessionSource
浏览器会话源的详细信息。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| id |
string |
浏览器会话源ID与测试运行的runID相同。 |
|
| type | Others |
浏览器会话源类型。 |
BrowserSessionSourceType
浏览器会话源类型。
| 值 | 说明 |
|---|---|
| PlaywrightWorkspacesTestRun |
浏览器会话源是Playwright Workspaces的测试运行。 |
| BrowserAutomationTool |
浏览器会话源是一个浏览器自动化工具。 |
| Others |
浏览器会话源属于其他类型。 |
BrowserSessionStatus
浏览器会话状态。
| 值 | 说明 |
|---|---|
| Created |
浏览器会话被创建。 |
| Active |
浏览器会话目前处于激活状态。 |
| Completed |
浏览器会话已完成。 |
| Failed |
浏览器会话失败了。 |
BrowserType
用于配置远程脚本执行的浏览器类型。
| 值 | 说明 |
|---|---|
| Chromium |
Chromium浏览器类型。 |
| Firefox |
Firefox浏览器类型。 |
| Webkit |
WebKit浏览器类型。 |
OS
该操作系统配置远程脚本执行。
| 值 | 说明 |
|---|---|
| Linux |
Linux作系统。 |
| Windows |
Windows操作系统。 |