Skip to content

Commit d4164e6

Browse files
authored
Feature/bidi 20250301 (#2203)
* Update Bidi Zh-cn
1 parent 7fb19f7 commit d4164e6

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "BiDirectional functionality"
2+
title: "双向功能"
33
linkTitle: "BiDi"
44
weight: 16
55
aliases: [
@@ -12,23 +12,27 @@ aliases: [
1212
]
1313
---
1414

15-
BiDirectional means that communication is happening in two directions simultaneously.
16-
The traditional WebDriver model involves strict request/response commands which only allows for communication to
17-
happen in one direction at any given time. In most cases this is what you want; it ensures that the browser is
18-
doing the expected things in the right order, but there are a number of interesting things that can be done with
19-
asynchronous interactions.
2015

21-
This functionality is currently available in a limited fashion with the [Chrome DevTools Protocol] (CDP),
22-
but to address some of its drawbacks, the Selenium team, along with the major
23-
browser vendors, have worked to create the new [WebDriver BiDi Protocol](https://w3c.github.io/webdriver-bidi/).
24-
This specification aims to create a stable, cross-browser API that leverages bidirectional
25-
communication for enhanced browser automation and testing functionality,
26-
including streaming events from the user agent to the controlling software via WebSockets.
27-
Users will be able to listen for and record or manipulate events as they happen during the course of a Selenium session.
16+
双向是指通信同时在两个方向上进行.
17+
传统的 WebDriver 模型涉及严格的请求/响应命令,
18+
在任何时候都只允许单向通信.
19+
在大多数情况下, 这正是您想要的;它能确保浏览器以正确的顺序执行预期的操作,
20+
但异步交互也有许多有趣的地方.
2821

29-
### Enabling BiDi in Selenium
3022

31-
In order to use WebDriver BiDi, setting the capability in the browser options will enable the required functionality:
23+
目前, [Chrome DevTools Protocol] (CDP) 可以有限地提供这种功能,
24+
但为了解决它的一些缺点,
25+
Selenium 团队与主要浏览器供应商一起创建了新的 [WebDriver BiDi 协议](https://w3c.github.io/webdriver-bidi/).
26+
该规范旨在创建一个稳定的跨浏览器 API,
27+
利用双向通信增强浏览器自动化和测试功能、
28+
包括通过 WebSockets 从用户代理到控制软件的流式事件.
29+
用户将能在 Selenium 会话过程中监听、记录或操作事件.
30+
31+
32+
### 在Selenium中启用 BiDi
33+
34+
为了使用 WebDriver BiDi,
35+
在浏览器选项中设置该功能将启用所需的功能:
3236

3337
{{< tabpane langEqualsHeader=true >}}
3438
{{< tab header="Java" >}}
@@ -51,17 +55,25 @@ options.setCapability("webSocketUrl", true);
5155
{{< /tab >}}
5256
{{< /tabpane >}}
5357

54-
This enables the WebSocket connection for bidirectional communication,
55-
unlocking the full potential of the WebDriver BiDi protocol.
5658

57-
Note that Selenium is updating its entire implementation from WebDriver Classic to WebDriver BiDi (while
58-
maintaining backwards compatibility as much as possible), but this section of documentation focuses on the new
59-
functionality that bidirectional communication allows.
60-
The low-level BiDi domains will be accessible in the code to the end user, but the goal is to provide
61-
high-level APIs that are straightforward methods of real-world use cases. As such, the low-level
62-
components will not be documented, and this section will focus only on the user-friendly
63-
features that we encourage users to take advantage of.
6459

65-
If there is additional functionality you'd like to see, please raise a
66-
[feature request](https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=&template=feature.md).
60+
这将启用用于双向通信的 WebSocket 连接、
61+
释放 WebDriver BiDi 协议的全部潜能.
62+
63+
64+
65+
请注意, Selenium 正在将其整个实现从 WebDriver Classic
66+
升级到 WebDriver BiDi (同时尽可能保持向后兼容性) ,
67+
但本部分文档的重点是双向通信所允许的新功能.
68+
69+
70+
71+
终端用户可以在代码中访问低级 BiDi 域,
72+
但我们的目标是提供高级应用程序接口,
73+
这些应用程序接口是真实世界用例的直接方法.
74+
因此, 我们将不对底层组件进行记录, 本节将只关注我们鼓励使用者利用的用户友好功能.
75+
76+
77+
如果您希望看到其他功能, 请提出
78+
[功能请求](https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=&template=feature.md).
6779

0 commit comments

Comments
 (0)