共用方式為


Browser Sessions - Get

為指定的會話和工作區 ID 建立一個瀏覽器會話。 需要 Entra ID 提供的持有人 JWT 存取權杖。

GET {endpoint}/playwrightworkspaces/{workspaceId}/browser-sessions/{sessionId}?api-version=2026-04-01-preview

URI 參數

名稱 位於 必要 類型 Description
endpoint
path True

string (uri)

Playwright 服務 API 端點 (通訊協定和主機名稱) 格式為 https://{region}.api.playwright.microsoft.com。 區域會對應至您的 Azure Playwright 工作區位置。 您可以在 的 Azure Playwright 工作區屬性 dataplaneUri中找到此值。

sessionId
path True

string

minLength: 3
maxLength: 36
pattern: [A-Za-z0-9]+(-[A-Za-z0-9]+)+

瀏覽器會話 ID 格式的 GUID 格式。

workspaceId
path True

string

minLength: 3
maxLength: 36
pattern: [A-Za-z0-9]+(-[A-Za-z0-9]+)+

GUID 格式的工作區識別碼。

api-version
query True

string

minLength: 1

用於此作業的 API 版本。

要求標頭

名稱 必要 類型 Description
x-ms-client-request-id

string (uuid)

要求不透明、全域唯一、用戶端產生的字串標識碼。

x-ms-useragent

string

可選標頭用於在無法明確設定標準「User-Agent」標頭時指定額外用戶端資訊,例如使用 Playwright 用戶端時。 該值應遵循標準的「User-Agent」標頭格式。

回應

名稱 類型 Description
200 OK

BrowserSession

要求已成功。

標題

x-ms-client-request-id: string

Other Status Codes

Azure.Core.Foundations.ErrorResponse

未預期的錯誤回應。

標題

x-ms-error-code: string

安全性

OAuth2Auth

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
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"
}

定義

名稱 Description
Azure.Core.Foundations.Error

錯誤物件。

Azure.Core.Foundations.ErrorResponse

包含錯誤詳細數據的回應。

Azure.Core.Foundations.InnerError

物件,包含有關錯誤的更特定資訊。 根據 Azure REST API 指引 - https://aka.ms/AzureRestApiGuidelines#handling-errors

BrowserSession

用於追蹤目的的瀏覽器會話模型。

BrowserSessionSource

瀏覽器會話來源的詳細資訊。

BrowserSessionSourceType

瀏覽器會話來源類型。

BrowserSessionStatus

瀏覽器會話狀態。

BrowserType

用來設定遠端腳本執行的瀏覽器類型。

OS

作業系統設定遠端腳本執行。

Azure.Core.Foundations.Error

錯誤物件。

名稱 類型 Description
code

string

其中一組伺服器定義的錯誤碼。

details

Azure.Core.Foundations.Error[]

導致此錯誤之特定錯誤的詳細數據陣列。

innererror

Azure.Core.Foundations.InnerError

物件,包含與目前對象有關錯誤更具體的資訊。

message

string

錯誤的人類可讀取表示法。

target

string

錯誤的目標。

Azure.Core.Foundations.ErrorResponse

包含錯誤詳細數據的回應。

名稱 類型 Description
error

Azure.Core.Foundations.Error

錯誤物件。

Azure.Core.Foundations.InnerError

物件,包含有關錯誤的更特定資訊。 根據 Azure REST API 指引 - https://aka.ms/AzureRestApiGuidelines#handling-errors

名稱 類型 Description
code

string

其中一組伺服器定義的錯誤碼。

innererror

Azure.Core.Foundations.InnerError

內部錯誤。

BrowserSession

用於追蹤目的的瀏覽器會話模型。

名稱 類型 Description
browserType

BrowserType

瀏覽器會話瀏覽器類型。

creatorId

string

瀏覽器會話建立者的 ID。

displayName

string

minLength: 1
maxLength: 200

瀏覽器會話顯示名稱。

durationInMilliseconds

integer (int64)

瀏覽器會話時間以毫秒計。

endTime

string (date-time)

瀏覽器會話結束時間(UTC)。

id

string

minLength: 3
maxLength: 36
pattern: [A-Za-z0-9]+(-[A-Za-z0-9]+)+

瀏覽器會話 ID 格式的 GUID 格式。

operatingSystem

OS

瀏覽器會話作業系統。

source

BrowserSessionSource

瀏覽器會話來源的詳細資訊。

startTime

string (date-time)

瀏覽器會話開始時間(UTC)。

status

BrowserSessionStatus

瀏覽器會話狀態。

BrowserSessionSource

瀏覽器會話來源的詳細資訊。

名稱 類型 預設值 Description
id

string

瀏覽器會話來源 ID 與測試執行時的 runID 相同。

type

BrowserSessionSourceType

Others

瀏覽器會話來源類型。

BrowserSessionSourceType

瀏覽器會話來源類型。

Description
PlaywrightWorkspacesTestRun

瀏覽器的會話來源是 Playwright Workspaces 的測試執行。

BrowserAutomationTool

瀏覽器會話來源是一個瀏覽器自動化工具。

Others

瀏覽器會話來源有其他類型。

BrowserSessionStatus

瀏覽器會話狀態。

Description
Created

瀏覽器會話被建立。

Active

瀏覽器工作階段目前仍在運作中。

Completed

瀏覽器會話已完成。

Failed

瀏覽器會話失敗了。

BrowserType

用來設定遠端腳本執行的瀏覽器類型。

Description
Chromium

Chromium 瀏覽器類型。

Firefox

Firefox 瀏覽器類型。

Webkit

WebKit 瀏覽器類型。

OS

作業系統設定遠端腳本執行。

Description
Linux

Linux 作業系統。

Windows

Windows 作業系統。