大网数据广告活动
Web 标准与前端开发

`session.status` command

· 52CE 我爱测

The `session.status` command of the `session` module returns information about whether the browser is able to create new BiDi sessions and may additionally include arbitrary meta information.

The session.status command of the session module returns information about whether the browser is able to create new BiDi sessions and may additionally include arbitrary meta information.

Since this command is used to check the status of the browser before creating a new session, it runs without an already active session. (In BiDi, such a command is called a static command.)

Syntax

{
  "method": "session.status",
  "params": {}
}

Parameters

None. However, you must include the params field and set it to an empty object ({}).

Return value

The following fields in the result object of the response describe the current status of the browser:

  • message
    • : A string with information about the browser's current status.
  • ready
    • : A boolean that indicates whether the browser is ready to create new sessions.
      • true: The browser is ready to create a new session.
      • false: The browser cannot accept new sessions because it already has an active session or is otherwise in a state where creating a session would fail.

Examples

Checking browser status before creating a session

With a WebDriver BiDi connection established, send the following message to check whether the browser is ready to create a new session:

{
  "id": 1,
  "method": "session.status",
  "params": {}
}

When the browser is available, it responds with:

{
  "id": 1,
  "type": "success",
  "result": {
    "ready": true,
    "message": ""
  }
}

If the browser already has an active session, the response might look as follows:

{
  "id": 1,
  "type": "success",
  "result": {
    "ready": false,
    "message": "Session already started"
  }
}

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。