Skip to content

Commit 0b8f171

Browse files
Update getting_started.zh-cn.md (SeleniumHQ#1335)[deploy site]
* Update getting_started.zh-cn.md * Update getting_started.zh-cn.md Modify some language expressions * Update getting_started.zh-cn.md Modify some language expressions * Modify some language expressions * Update applicability.zh-cn.md * Update components.zh-cn.md * Update errors.zh-cn.md make sentences more fluent * Update components.zh-cn.md add some notes * Update windows.zh-cn.md format java code * Update errors.zh-cn.md wrap some lines --------- Co-authored-by: ian zhang <[email protected]>
1 parent f79eff2 commit 0b8f171

File tree

5 files changed

+238
-323
lines changed

5 files changed

+238
-323
lines changed

website_and_docs/content/documentation/grid/applicability.zh-cn.md

+14-21
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,30 @@ aliases: [
1919
</p>
2020
{{% /pageinfo %}}
2121

22-
When would you use a Selenium Grid?
22+
什么情况下可以使用 `Selenium Grid`
2323

24-
* To run your tests in parallel, against different browser types, browser versions, operating systems
25-
* To reduce the time needed to execute a test suite
24+
* 想要在不同的浏览器类型、浏览器版本和操作系统上并行运行测试时
25+
* 想要缩短执行测试案例所需的时间
2626

27-
Selenium Grid runs test suites in parallel against multiple machines (called Nodes).
28-
For large and long-running test suites, this can save minutes, hours, or perhaps days.
29-
This shortens the turnaround time for test results as your application under test (AUT)
30-
changes.
27+
`Selenium Grid` 可以并行地在多台计算机(称为节点)上运行测试案例。对于大型和长时间运行的测试案例,这可以节省几分钟、几小时甚至几天的时间。
3128

32-
Grid can run tests (in parallel) against multiple different browsers, and it can
33-
run against multiple instances of the same browser. As an example, let's imagine
34-
a Grid with six Nodes. The first machine has Firefox's latest version,
35-
the second has Firefox "latest minus one", the third gets the latest Chrome, and
36-
the remaining three machines are Mac Minis, which allows for three tests to run in
37-
parallel on the latest version of Safari.
29+
这有效的缩短了测试结果的反馈时间,使得在测试的应用程序发生变化时能够更快地得到测试结果。
3830

39-
Execution time can be expressed as a simple formula:
31+
`Grid` 可以并行地运行测试,支持多种不同的浏览器类型,并且可以同时运行多个相同浏览器的实例。
4032

41-
```Number of Tests * Average Test Time / Number of Nodes = Total Execution Time```
33+
举个例子,假设一个拥有六个节点的Grid。第一台计算机拥有Firefox的最新版本,第二台拥有Firefox的上一个版本,第三台运行最新版Chrome,而其余三台机器是Mac Mini,允许在最新版本的Safari上并行运行三个测试。
34+
35+
执行时间可以用一个简单的公式来表示:
36+
37+
```测试次数 × 平均测试时间 / 节点数 = 总执行时间```
4238

4339
15 * 45s / 1 = 11m 15s // Without Grid
4440
15 * 45s / 5 = 2m 15s // Grid with 5 Nodes
4541
15 * 45s / 15 = 45s // Grid with 15 Nodes
4642
100 * 120s / 15 = 13m 20s // Would take over 3 hours without Grid
4743

48-
As the test suite is executing, the Grid allocates the tests to run against these
49-
browsers as configured in the tests.
44+
在测试案例执行时,`Grid` 会按照测试配置将测试分配到相应的浏览器上运行。
5045

51-
A configuration such as this can greatly speed up the execution time of even the largest Selenium test suites.
46+
即使对于比较复杂的 `Selenium` 测试案例,这样的配置也可以极大地加快执行时间。
5247

53-
Selenium Grid is a completely native part of the Selenium project, and is maintained in parallel by the same team
54-
of committers who work in the core Selenium development. Recognizing the importance of test execution speed, Grid
55-
has been a critical part of the Selenium project since the earliest days.
48+
`Selenium Grid``Selenium` 项目中的重要组成部分,由同一团队的核心Selenium开发人员并行维护。由于意识到测试执行速度的重要性,`Grid` 自设计之初就成为 `Selenium` 项目的关键部分。

website_and_docs/content/documentation/grid/components.zh-cn.md

+31-72
Original file line numberDiff line numberDiff line change
@@ -19,105 +19,64 @@ aliases: [
1919
</p>
2020
{{% /pageinfo %}}
2121

22+
Selenium Grid 4 是对以前版本的彻底重写。除了对性能和标准合规性进行全面改进外,还分解了 `Grid` 的不同功能以反映更现代的计算和软件开发时代。 Selenium Grid 4 专为容器化和云分布式可扩展性而构建,是现代时代的全新解决方案。
2223

23-
Selenium Grid 4 is a ground-up rewrite from previous versions. In addition to a comprehensive
24-
set of improvements to performance and standards compliance, the different functions of the grid were
25-
broken out to reflect a more modern age of computing and software development. Purpose-build for containerization
26-
and cloud-distributed scalability, Selenium Grid 4 is a wholly new solution for the modern era.
27-
28-
{{< card header="**Grid Components**" footer="Grid components shown in the fully distributed mode" >}}
29-
![Selenium Grid 4 Components](/images/documentation/grid/components.png "Selenium Grid 4 Components")
24+
{{< card header="**Grid Components**" footer="全分布式展示的Grid组件" >}}
25+
![Selenium Grid 4 组件](/images/documentation/grid/components.png "Selenium Grid 4 Components")
3026
{{< /card >}}
3127

32-
## Router
33-
34-
The **Router** is the entry point of the Grid, receiving all external requests, and forwards them to
35-
the correct component.
28+
## 路由器(Router)
3629

37-
If the **Router** receives a new session request, it will be forwarded to the **New Session Queue**.
30+
**路由器** 是 Grid 的入口点,接收所有外部请求,并将它们转发给正确的组件。
3831

39-
If the request belongs to an existing session, the **Router** will query the **Session Map** to get
40-
the **Node** ID where the session is running, and then the request will be forwarded directly to the
41-
**Node**.
32+
如果**路由器**收到新的会话请求,它将被转发到**新会话队列**
4233

43-
The **Router** balances the load in the Grid by sending the requests to the component that is able
44-
to handle them better, without overloading any component that is not needed in the process.
34+
如果请求属于一个已经存在的session,**路由器**会查询**Session Map**得到session运行所在的**Node** ID,然后将请求直接转发给**Node**
4535

46-
## Distributor
36+
**路由器**通过将请求发送到能够更好地处理它们的组件来平衡网格中的负载,而不会使过程中不需要的任何组件过载。
4737

48-
The **Distributor** has two main responsibilities:
38+
## 分发器(Distributor
4939

50-
#### Register and keep track of all Nodes and their capabilities
40+
**分发器**有两个主要职责:
5141

52-
A **Node** registers to the **Distributor** by sending a **Node** registration event through
53-
the **Event Bus**. The **Distributor** reads it, and then tries to reach the **Node** via HTTP
54-
to confirm its existance. If the request is successfull, the **Distributor** registers the Node
55-
and keeps track of all **Nodes** capabilities through the **GridModel**.
42+
#### 注册并跟踪所有Node及其功能
5643

57-
#### Query the New Session Queue and process any pending new session requests
44+
**Node**通过**事件总线**发送**Node**注册事件来注册到**分发器****分发器**读取它,然后尝试通过 HTTP 到达**Node**以确认它的存在。如果请求成功,**Distributor**注册节点并通过 **GridModel** 跟踪所有**Node**功能。
5845

59-
When a new session request is sent to the **Router**, it gets forwarded to the **New Session Queue**,
60-
where it will wait in the queue. The **Distributor** will poll the **New Session Queue** for pending
61-
new session requests, and then finds a suitable **Node** where the session can be created. After the
62-
session has been created, the **Distributor** stores in the **Session Map** the relation between the
63-
session id and **Node** where the session is being executed.
46+
#### 查询新会话队列并处理任何未决的新会话请求
6447

65-
## Session Map
48+
当一个新的会话请求被发送到**路由器**时,它被转发到**新会话队列**,它将在队列中等待。 **Distributor** 将轮询**新会话队列**以查找未决的新会话请求,然后找到可以创建会话的合适**Node**。会话创建后,**分发器**将会话 ID 与正在执行会话的**Node**之间的关系存储在**会话映射**中。
6649

67-
The **Session Map** is a data store that keeps the relationship between the session id and the **Node**
68-
where the session is running. It supports the **Router** in the process of forwarding a request to the
69-
**Node**. The **Router** will ask the **Session Map** for the **Node** associated to a session id.
50+
## 会话映射(Session Map)
7051

71-
## New Session Queue
52+
**会话映射** 是一个数据存储,用于保存会话 ID 和运行会话的**Node**之间的关系。它支持**路由器**在将请求转发到**Node**的过程中进行查询。**路由器**将向**会话映射**询问与会话 ID 关联的**Node**
7253

73-
The **New Session Queue** holds all the new session requests in a FIFO order. It has configurable
74-
parameters for setting the request timeout and request retry interval (how often the timeout will
75-
be checked).
54+
## 新会话队列(New Session Queue)
7655

77-
The **Router** adds the new session request to the **New Session Queue** and waits for the response.
78-
The **New Session Queue** regularly checks if any request in the queue has timed out, if so the request
79-
is rejected and removed immediately.
56+
**新会话队列**按先进先出的顺序保存所有新会话请求。它具有可配置的参数,用于设置请求超时和请求重试间隔(检查超时的频率)。
8057

81-
The **Distributor** regularly checks if a slot is available. If so, the **Distributor** polls the
82-
**New Session Queue** for the first matching request. The **Distributor** then attempts to create
83-
a new session.
58+
**路由器****新会话请求**添加到**新会话队列**中并等待响应。**新会话队列**定期检查队列中是否有任何请求超时,如果是,则立即拒绝并将其删除。
8459

85-
Once the requested capabilities match the capabilities of any of the free **Node** slots, the **Distributor**
86-
attempts to get the available slot. If all the slots are busy, the **Distributor** will send the request back
87-
to the queue. If request times out while retrying or adding to the front of the queue, it will be rejected.
60+
**分发器**定期检查是否有可用的插槽。如果有可用的插槽,则**分发器**会轮询**新会话队列**以查找第一个匹配的请求。然后,**分发器**尝试创建**新会话**
8861

89-
After a session is created successfully, the **Distributor** sends the session information to the **New Session Queue**,
90-
which then gets sent back to the **Router**, and finally to the client.
62+
一旦请求的功能与任何空闲**Node**插槽的功能匹配,**分发器**将尝试获取可用插槽。如果所有插槽都已忙碌,则**分发器**将将请求发送回队列。如果请求在重试或添加到队列的前面时超时,则会被拒绝。
9163

92-
## Node
64+
成功创建会话后,**分发器**将会话信息发送到**新会话队列**,该信息然后被发送回**路由器**,最终发送给客户端。
9365

94-
A Grid can contain multiple **Nodes**. Each **Node** manages the slots for the available browsers of the machine
95-
where it is running.
66+
## 节点(Node)
9667

97-
The **Node** registers itself to the **Distributor** through the **Event Bus**, and its configuration is sent as
98-
part of the registration message.
68+
一个`Grid`可以包含多个**Node**。每个**Node**管理它所在机器上可用浏览器的插槽。
9969

100-
By default, the **Node** auto-registers all browser drivers available on the path of the machine where it runs.
101-
It also creates one slot per available CPU for Chromium based browsers and Firefox. For Safari, only one slot is
102-
created. Through a specific [configuration]({{< ref "/configuration" >}}), it can run sessions in Docker
103-
containers or relay commands.
70+
**Node**通过**事件总线****分发器**注册自己,并将其配置作为注册消息发送。
10471

105-
A **Node** only executes the received commands, it does not evaluate, make judgments, or control anything other
106-
than the flow of commands and responses. The machines where the **Node** is running does not need to have the
107-
same operating system as the other components. For example, A Windows **Node** might have the capability of
108-
offering IE Mode on Edge as a browser option, whereas this would not be possible on Linux or Mac, and a Grid can
109-
have multiple **Nodes** configured with Windows, Mac, or Linux.
72+
默认情况下,**Node**会自动注册其所在机器上路径中可用的所有浏览器驱动程序。它还为基于Chromium的浏览器和Firefox创建每个可用CPU一个插槽。对于Safari,只创建一个插槽。通过特定的[配置]({{< ref "/configuration" >}}),它可以在Docker容器中运行会话或转发命令。
11073

111-
## Event Bus
74+
**Node**仅执行接收到的命令,不评估、不做出判断或控制任何除命令和响应流之外的东西。**Node**所在的机器不需要与其他组件具有相同的操作系统。例如,Windows节点可能具有在Edge上提供IE模式作为浏览器选项的能力,而在Linux或Mac上则不可能,网格可以配置多个具有Windows、Mac或Linux的**Node**
11275

113-
The **Event Bus** serves as a communication path between the **Nodes**, **Distributor**, **New Session Queue**,
114-
and **Session Map**. The Grid does most of its internal communication through messages, avoiding expensive HTTP
115-
calls. When starting the Grid in its fully distributed mode, the **Event Bus** is the first component that
116-
should be started.
76+
## 事件总线(Event Bus)
11777

78+
**事件总线**作为**节点****分发器****新会话队列****会话映射**之间的通信路径。`Grid` 的大部分内部通信都通过消息进行,避免了频繁的HTTP调用。在完全分布式模式下启动`Grid` 时,**事件总线**应该是第一个组件。
11879

119-
{{% alert title="Running your own Grid" color="primary" %}}
120-
Looking forward to using all these components and run your own Grid?
121-
Head to the ["Getting Started"]({{< ref "getting_started.md" >}})
122-
section to understand how to put all these pieces together.
80+
{{% alert title="运行自己的Grid" color="primary" %}}
81+
想要使用所有这些组件并运行自己的网格?请前往["入门"]({{< ref "getting_started.md" >}})部分了解如何将所有这些部分组合在一起。
12382
{{% /alert %}}

0 commit comments

Comments
 (0)