Skip to content

docs: Update toml Doc for zh-cn #2313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 13 additions & 20 deletions website_and_docs/content/documentation/grid/applicability.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,39 @@ title: "什么时候应该使用Grid"
linkTitle: "适用性"
weight: 4
description: >
Is Grid right for you?
Grid适合您吗?
aliases: [
"/documentation/zh-cn/grid/when_to_use_grid/",
"/zh-cn/documentation/grid/when_to_use_grid"
]
---

{{% pageinfo color="warning" %}}
<p class="lead">
<i class="fas fa-language d-4"></i>
Page being translated from English to Chinese.
Do you speak Chinese? Help us to translate
it by sending us pull requests!
</p>
{{% /pageinfo %}}

什么情况下可以使用 `Selenium Grid` ?

* 想要在不同的浏览器类型、浏览器版本和操作系统上并行运行测试时
* 想要缩短执行测试案例所需的时间

`Selenium Grid` 可以并行地在多台计算机(称为节点)上运行测试案例对于大型和长时间运行的测试案例,这可以节省几分钟、几小时甚至几天的时间
`Selenium Grid` 可以并行地在多台计算机(称为节点)上运行测试案例. 对于大型和长时间运行的测试案例,这可以节省几分钟、几小时甚至几天的时间.

这有效的缩短了测试结果的反馈时间,使得在测试的应用程序发生变化时能够更快地得到测试结果
这有效的缩短了测试结果的反馈时间,使得在测试的应用程序发生变化时能够更快地得到测试结果.

`Grid` 可以并行地运行测试,支持多种不同的浏览器类型,并且可以同时运行多个相同浏览器的实例
`Grid` 可以并行地运行测试,支持多种不同的浏览器类型,并且可以同时运行多个相同浏览器的实例.

举个例子,假设一个拥有六个节点的Grid第一台计算机拥有Firefox的最新版本,第二台拥有Firefox的上一个版本,第三台运行最新版Chrome,而其余三台机器是Mac Mini,允许在最新版本的Safari上并行运行三个测试
举个例子,假设一个拥有六个节点的Grid. 第一台计算机拥有Firefox的最新版本,第二台拥有Firefox的上一个版本,第三台运行最新版Chrome,而其余三台机器是Mac Mini,允许在最新版本的Safari上并行运行三个测试.

执行时间可以用一个简单的公式来表示:

```测试次数 × 平均测试时间 / 节点数 = 总执行时间```

15 * 45s / 1 = 11m 15s // Without Grid
15 * 45s / 5 = 2m 15s // Grid with 5 Nodes
15 * 45s / 15 = 45s // Grid with 15 Nodes
100 * 120s / 15 = 13m 20s // Would take over 3 hours without Grid
15 * 45s / 1 = 11m 15s // 没有Grid
15 * 45s / 5 = 2m 15s // 5节点的Grid
15 * 45s / 15 = 45s // 15节点的Grid
100 * 120s / 15 = 13m 20s // 如果没有Grid, 需要3个多小时

在测试案例执行时,`Grid` 会按照测试配置将测试分配到相应的浏览器上运行
在测试案例执行时,`Grid` 会按照测试配置将测试分配到相应的浏览器上运行.

即使对于比较复杂的 `Selenium` 测试案例,这样的配置也可以极大地加快执行时间
即使对于比较复杂的 `Selenium` 测试案例,这样的配置也可以极大地加快执行时间.

`Selenium Grid` 是 `Selenium` 项目中的重要组成部分,由同一团队的核心Selenium开发人员并行维护。由于意识到测试执行速度的重要性,`Grid` 自设计之初就成为 `Selenium` 项目的关键部分。
`Selenium Grid` 是 `Selenium` 项目中的重要组成部分,由同一团队的核心Selenium开发人员并行维护.
由于意识到测试执行速度的重要性,`Grid` 自设计之初就成为 `Selenium` 项目的关键部分.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ aliases: [
]
---

{{% pageinfo color="warning" %}}
<p class="lead">
<i class="fas fa-language d-4"></i>
Page being translated from
English to Chinese. Do you speak Chinese? Help us to translate
it by sending us pull requests!
</p>
{{% /pageinfo %}}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ webdriver-executable = '/path/to/chromedriver/95/chromedriver'
则最多有2个并发会话.
原型配置需要映射一个Docker映像,
Docker的守护进程需要通过http/tcp公开.
此外可以通过 `devices` 属性定义在主机上可访问的哪些设备文件将在容器中可用
有关 docker 设备映射如何工作的更多信息请参阅 [docker](https://docs.docker.com/engine/reference/commandline/run/#add-host-device-to-container---device) 文档
此外, 可以通过 `devices` 属性定义在主机上可访问的哪些设备文件将在容器中可用.
有关 docker 设备映射如何工作的更多信息, 请参阅 [docker](https://docs.docker.com/engine/reference/commandline/run/#add-host-device-to-container---device) 文档.

```toml
[node]
Expand Down Expand Up @@ -182,12 +182,11 @@ HttpCommandExecutor executor = new HttpCommandExecutor(clientConfig);
RemoteWebDriver driver = new RemoteWebDriver(executor, new ChromeOptions());
```

In other languages, you can use the URL http://admin:myStrongPassword@localhost:4444
在其他语言中, 您可以使用 URL http://admin:myStrongPassword@localhost:4444

### Setting custom capabilities for matching specific Nodes
### 为匹配特定节点设置自定义功能

**Important:** Custom capabilities need to be set in the configuration in all Nodes. They also
need to be included always in every session request.
**重要提示:** 自定义功能需要在所有节点的配置中进行设置. 并且在每次会话请求中都必须包含这些功能.

```toml
[node]
Expand All @@ -199,7 +198,7 @@ stereotype = '{"browserName": "firefox", "platformName": "macOS", "browserVersio
max-sessions = 5
```

Here is a Java example showing how to match that Node
这里有一个 Java 示例, 展示了如何匹配那个节点

```java
FirefoxOptions options = new FirefoxOptions();
Expand All @@ -212,14 +211,16 @@ driver.get("https://selenium.dev");
driver.quit();
```

### Enabling Managed downloads by the Node.
### 启用节点的托管下载功能.

The Node can be instructed to manage downloads automatically. This will cause the Node to save all files that were downloaded for a particular session into a temp directory, which can later be retrieved from the node.
To turn this capability on, use the below configuration:
节点可以被设置为自动管理下载.
这将导致节点会把特定会话中下载的所有文件保存到一个临时目录中,
之后可以从节点中获取这些文件.
要启用此功能, 请使用以下配置:

```toml
[node]
enable-managed-downloads = true
```

Refer to the [CLI section]({{< ref "cli_options.md#enabling-managed-downloads-by-the-node" >}}) for a complete example.
有关完整示例, 请参阅[CLI章节]({{< ref "cli_options.md#enabling-managed-downloads-by-the-node" >}}) .
Loading