Skip to content

Commit 55f9a01

Browse files
alaahongdiemol
andauthored
Add Chinese translation of "working_with_select_elements" (#284) [deploy site]
- support_packages/working_with_select_elements.zh-cn.md Co-authored-by: Diego Molina <[email protected]>
1 parent 1378b2a commit 55f9a01

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

docs_source_files/content/support_packages/working_with_select_elements.zh-cn.md

+15-24
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
---
2-
title: "Working with select elements"
2+
title: "同选择元素一起工作"
33
weight: 3
44
---
5-
6-
{{% notice info %}}
7-
<i class="fas fa-language"></i> 页面需要从英语翻译为简体中文。
8-
您熟悉英语与简体中文吗?帮助我们翻译它,通过 pull requests 给我们!
9-
{{% /notice %}}
10-
11-
Select elements can require quite a bit of boiler plate code to automate.
12-
To reduce this and make your tests cleaner, there is a
13-
`Select` class in the Selenium support package.
14-
To use it, you will need the following import statement:
5+
6+
选择元素可能需要大量样板代码才能自动化.
7+
为了减少这种情况并使您的测试更干净, 在Selenium的support包中有一个
8+
`Select` 类.
9+
要使用它,您将需要以下导入语句:
1510

1611
{{< code-tab >}}
1712
{{< code-panel language="java" >}}
@@ -34,8 +29,7 @@ import org.openqa.selenium.support.ui.Select
3429
{{< / code-panel >}}
3530
{{< / code-tab >}}
3631

37-
You are then able to create a Select object using a WebElement that
38-
references a `<select>` element.
32+
然后,您能够参考 `<select>` 元素,基于WebElement创建一个Select对象。
3933

4034
{{< code-tab >}}
4135
{{< code-panel language="java" >}}
@@ -63,10 +57,8 @@ val selectObject = new Select(selectElement)
6357
{{< / code-panel >}}
6458
{{< / code-tab >}}
6559

66-
The Select object will now give you a series of commands
67-
that allow you to interact with a `<select>` element.
68-
First of all, there are different ways of selecting an option
69-
from the `<select>` element.
60+
Select对象现在将为您提供一系列命令,使您可以与 `<select>` 元素进行交互.
61+
首先,有多种方法可以从 `<select>` 元素中选择一个选项.
7062

7163
```html
7264
<select>
@@ -76,7 +68,7 @@ from the `<select>` element.
7668
</select>
7769
```
7870

79-
There are three ways to select the first option from the above element:
71+
有三种方法可以从上述元素中选择第一个选项:
8072

8173
{{< code-tab >}}
8274
{{< code-panel language="java" >}}
@@ -134,7 +126,7 @@ selectObject.selectByVisibleText("Bread")
134126
{{< / code-panel >}}
135127
{{< / code-tab >}}
136128

137-
You can then check which options are selected by using:
129+
然后,您可以检视所有被选择的选项:
138130

139131
{{< code-tab >}}
140132
{{< code-panel language="java" >}}
@@ -174,8 +166,7 @@ val firstSelectedOption = selectObject.firstSelectedOption
174166
{{< / code-tab >}}
175167

176168

177-
Or you may just be interested in what `<option>` elements
178-
the `<select>` element contains:
169+
或者您可能只对 `<select>` 元素包含哪些 `<option>` 元素感兴趣:
179170

180171
{{< code-tab >}}
181172
{{< code-panel language="java" >}}
@@ -203,7 +194,7 @@ val allAvailableOptions = selectObject.options
203194
{{< / code-panel >}}
204195
{{< / code-tab >}}
205196

206-
If you want to deselect any elements, you now have four options:
197+
如果要取消选择任何元素,现在有四个选项:
207198

208199
{{< code-tab >}}
209200
{{< code-panel language="java" >}}
@@ -276,8 +267,8 @@ selectObject.deselectAll()
276267
{{< / code-panel >}}
277268
{{< / code-tab >}}
278269

279-
Finally, some `<select>` elements allow you to select more than one option.
280-
You can find out if your `<select>` element is one of these by using:
270+
最后,一些 `<select>` 元素允许您选择多个选项.
271+
您可以通过使用以下命令确定您的 `<select>` 元素是否允许多选:
281272

282273
{{< code-tab >}}
283274
{{< code-panel language="java" >}}

0 commit comments

Comments
 (0)