Skip to content

Commit 6834e27

Browse files
alaahongdiemol
andauthored
Update Chinese translation of "js_alerts_prompts_and_confirmations" (#265)
- webdriver/js_alerts_prompts_and_confirmations.zh-cn.md Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
1 parent 1ae4a9c commit 6834e27

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

docs_source_files/content/webdriver/js_alerts_prompts_and_confirmations.zh-cn.md

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
---
2-
title: "JavaScript alerts, prompts and confirmations"
2+
title: "JavaScript 警告框,提示框和确认框"
33
weight: 6
44
---
55

6-
{{% notice info %}}
7-
<i class="fas fa-language"></i> 页面需要从英语翻译为简体中文。
8-
您熟悉英语与简体中文吗?帮助我们翻译它,通过 pull requests 给我们!
9-
{{% /notice %}}
6+
WebDriver提供了一个API, 用于处理JavaScript提供的三种类型的原生弹窗消息. 这些弹窗由浏览器提供限定的样式.
107

11-
WebDriver provides an API for working with the three types of native
12-
popup message offered by JavaScript. These popups are styled by the
13-
browser and offer limited customisation.
8+
## Alerts 警告框
149

15-
## Alerts
10+
其中最基本的称为警告框, 它显示一条自定义消息, 以及一个用于关闭该警告的按钮, 在大多数浏览器中标记为"确定"(OK). 在大多数浏览器中, 也可以通过按"关闭"(close)按钮将其关闭, 但这始终与“确定”按钮具有相同的作用. <a onclick="window.alert('Sample alert')">查看样例警告框</a>.
1611

17-
The simplest of these is referred to as an alert, which shows a
18-
custom message, and a single button which dismisses the alert, labelled
19-
in most browsers as OK. It can also be dismissed in most browsers by
20-
pressing the close button, but this will always do the same thing as
21-
the OK button. <a onclick="window.alert('Sample alert')">See an example alert</a>.
22-
23-
WebDriver can get the text from the popup and accept or dismiss these
24-
alerts.
12+
WebDriver可以从弹窗获取文本并接受或关闭这些警告.
2513

2614
{{< code-tab >}}
2715
{{< code-panel language="java" >}}
@@ -109,13 +97,11 @@ alert.accept()
10997
{{< / code-panel >}}
11098
{{< / code-tab >}}
11199

112-
## Confirm
100+
## Confirm 确认框
113101

114-
A confirm box is similar to an alert, except the user can also choose
115-
to cancel the message. <a onclick="window.confirm('Are you sure?')">See
116-
a sample confirm</a>.
102+
确认框类似于警告框, 不同之处在于用户还可以选择取消消息. <a onclick="window.confirm('Are you sure?')">查看样例确认框</a>.
117103

118-
This example also shows a different approach to storing an alert:
104+
此示例还呈现了警告的另一种实现:
119105

120106
{{< code-tab >}}
121107
{{< code-panel language="java" >}}
@@ -215,14 +201,11 @@ alert.dismiss()
215201
{{< / code-panel >}}
216202
{{< / code-tab >}}
217203

218-
## Prompt
204+
## Prompt 提示框
219205

220-
Prompts are similar to confirm boxes, except they also include a text
221-
input. Similar to working with form elements, you can use WebDriver's
222-
send keys to fill in a response. This will completely replace the placeholder
223-
text. Pressing the cancel button will not submit any text.
206+
提示框与确认框相似, 不同之处在于它们还包括文本输入. 与处理表单元素类似, 您可以使用WebDriver的sendKeys来填写响应. 这将完全替换占位符文本. 按下取消按钮将不会提交任何文本.
224207
<a onclick="window.prompt('What is your tool of choice?',navigator.appName)">
225-
See a sample prompt</a>.
208+
查看样例提示框</a>.
226209

227210

228211
{{< code-tab >}}

0 commit comments

Comments
 (0)