Skip to content

Commit b40a1f8

Browse files
authored
update edge doc (#2158)
1 parent 0c704ac commit b40a1f8

File tree

1 file changed

+80
-74
lines changed
  • website_and_docs/content/documentation/webdriver/browsers

1 file changed

+80
-74
lines changed

website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md

Lines changed: 80 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ description: >-
66
这些是特定于微软Edge浏览器的功能和特性.
77
---
88

9-
微软Edge是用Chromium实现的最早支持版本是v79.
9+
微软Edge是用Chromium实现的, 最早支持版本是v79.
1010
与Chrome类似, Edge驱动的主版本号必须与Edge浏览器的主要版本匹配.
1111

1212
[Chrome 页面]({{< ref "chrome.md" >}}) 上找到的所有capabilities和选项也适用于Edge.
1313

1414
## 选项
1515

16-
Capabilities common to all browsers are described on the [Options page]({{< ref "../drivers/options.md" >}}).
16+
所有浏览器的共有功能在 [Options 页面]({{< ref "../drivers/options.md" >}}).
1717

18-
Capabilities unique to Chromium are documented at Google's page for
18+
Chromium独有的功能记录在谷歌的
1919
[Capabilities & ChromeOptions](https://chromedriver.chromium.org/capabilities)
2020

2121
使用基本定义的选项启动 Edge 会话如下所示:
@@ -41,16 +41,16 @@ Capabilities unique to Chromium are documented at Google's page for
4141
{{< /tab >}}
4242
{{< /tabpane >}}
4343

44-
### Arguments
44+
### 参数
4545

46-
The `args` parameter is for a list of command line switches to be used when starting the browser.
47-
There are two excellent resources for investigating these arguments:
46+
`args` 参数用于列出启动浏览器时使用的命令行开关.
47+
有两个很好的资源可用于研究这些参数:
4848
* [Chrome Flags for Tooling](https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md)
4949
* [List of Chromium Command Line Switches](https://peter.sh/experiments/chromium-command-line-switches/)
5050

51-
Commonly used args include `--start-maximized` and `--headless=new` and `--user-data-dir=...`
51+
常用参数包括 `--start-maximized` `--headless=new` `--user-data-dir=...`
5252

53-
Add an argument to options:
53+
为options添加参数:
5454

5555
{{< tabpane text=true >}}
5656
{{< tab header="Java" >}}
@@ -73,12 +73,12 @@ Add an argument to options:
7373
{{< /tab >}}
7474
{{< /tabpane >}}
7575

76-
### Start browser in a specified location
76+
### 在指定位置启动浏览器
7777

78-
The `binary` parameter takes the path of an alternate location of browser to use. With this parameter you can
79-
use chromedriver to drive various Chromium based browsers.
78+
`binary` 参数包含要使用的浏览器备用位置的路径.
79+
使用此参数, 您可以使用 chromedriver 驱动各种基于 Chromium 的浏览器.
8080

81-
Add a browser location to options:
81+
在options中添加浏览器位置:
8282

8383
{{< tabpane text=true >}}
8484
{{< tab header="Java" >}}
@@ -101,13 +101,15 @@ Add a browser location to options:
101101
{{< /tab >}}
102102
{{< /tabpane >}}
103103

104-
### Add extensions
104+
### 添加扩展
105105

106-
The `extensions` parameter accepts crx files. As for unpacked directories,
107-
please use the `load-extension` argument instead, as mentioned in
108-
[this post](https://chromedriver.chromium.org/extensions).
109106

110-
Add an extension to options:
107+
`extensions`参数接受 crx 文件.
108+
至于已解压的目录、中提到,
109+
请使用[本文](https://chromedriver.chromium.org/extensions)中提及的 `load-extension`.
110+
111+
112+
在options中添加扩展:
111113

112114
{{< tabpane text=true >}}
113115
{{< tab header="Java" >}}
@@ -130,10 +132,11 @@ Add an extension to options:
130132
{{< /tab >}}
131133
{{< /tabpane >}}
132134

133-
### Keeping browser open
135+
### 保持浏览器打开
134136

135-
Setting the `detach` parameter to true will keep the browser open after the process has ended,
136-
so long as the quit command is not sent to the driver.
137+
`detach` 参数设置为 true后,
138+
只要不向driver发送退出命令,
139+
就可以在进程结束后保持浏览器打开.
137140

138141
{{< tabpane text=true >}}
139142
{{% tab header="Java" %}}
@@ -156,15 +159,15 @@ so long as the quit command is not sent to the driver.
156159
{{< /tab >}}
157160
{{< /tabpane >}}
158161

159-
### Excluding arguments
162+
### 排除参数
160163

161-
MSEdgedriver has several default arguments it uses to start the browser.
162-
If you do not want those arguments added, pass them into `excludeSwitches`.
163-
A common example is to turn the popup blocker back on. A full list of default arguments
164-
can be parsed from the
164+
MSEdgedriver 有几个用于启动浏览器的默认参数.
165+
如果不希望添加这些参数, 可将它们传递到 `excludeSwitches`.
166+
一个常见的例子就是重新打开弹出窗口拦截器.
167+
默认参数的完整列表参考
165168
[Chromium Source Code](https://source.chromium.org/chromium/chromium/src/+/main:chrome/test/chromedriver/chrome_launcher.cc)
166169

167-
Set excluded arguments on options:
170+
在options中设置排除参数:
168171

169172
{{< tabpane text=true >}}
170173
{{< tab header="Java" >}}
@@ -188,25 +191,26 @@ Set excluded arguments on options:
188191
{{< /tabpane >}}
189192

190193

191-
## Service
194+
## 服务
192195

193-
Examples for creating a default Service object, and for setting driver location and port
194-
can be found on the [Driver Service]({{< ref "../drivers/service.md" >}}) page.
196+
创建默认服务对象, 设置驱动程序位置和端口的示例可以参考
197+
[Driver服务]({{< ref "../drivers/service.md" >}}) 页面.
195198

196-
### Log output
199+
### 日志输出
197200

198-
Getting driver logs can be helpful for debugging issues. The Service class lets you
199-
direct where the logs will go. Logging output is ignored unless the user directs it somewhere.
201+
获取驱动程序日志有助于调试问题。
202+
服务类可让您配置日志的输出。
203+
日志输出会被忽略, 除非用户显示指定.
200204

201-
#### File output
205+
#### 文件输出
202206

203-
To change the logging output to save to a specific file:
207+
更改日志输出以保存到特定文件:
204208

205209
{{< tabpane text=true >}}
206210
{{% tab header="Java" %}}
207211
{{< badge-version version="4.10" >}}
208212
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L101" >}}
209-
**Note**: Java also allows setting file output by System Property:\
213+
**注意**: Java同样允许在系统属性中配置文件输出:\
210214
Property key: `EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY`\
211215
Property value: String representing path to log file
212216
{{% /tab %}}
@@ -228,17 +232,17 @@ Property value: String representing path to log file
228232
{{< /tab >}}
229233
{{< /tabpane >}}
230234

231-
#### Console output
235+
#### 控制台输出
232236

233-
To change the logging output to display in the console as STDOUT:
237+
要更改日志输出, 使其在控制台中显示为标准输出:
234238

235239
{{< tabpane text=true >}}
236240
{{% tab header="Java" %}}
237241
{{< badge-version version="4.10" >}}
238242
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L114" >}}
239-
**Note**: Java also allows setting console output by System Property;\
240-
Property key: `EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY`\
241-
Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
243+
**注意**: Java同样允许在系统属性中配置控制台输出:\
244+
属性键: `EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY`\
245+
属性值: `DriverService.LOG_STDOUT` `DriverService.LOG_STDERR`
242246
{{% /tab %}}
243247
{{< tab header="Python" >}}
244248
{{< badge-version version="4.11" >}}
@@ -260,18 +264,19 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
260264
{{< /tab >}}
261265
{{< /tabpane >}}
262266

263-
### Log level
264-
There are 6 available log levels: `ALL`, `DEBUG`, `INFO`, `WARNING`, `SEVERE`, and `OFF`.
265-
Note that `--verbose` is equivalent to `--log-level=ALL` and `--silent` is equivalent to `--log-level=OFF`,
266-
so this example is just setting the log level generically:
267+
### 日志级别
268+
269+
有 6 种可用的日志级别: `ALL`, `DEBUG`, `INFO`, `WARNING`, `SEVERE`, 以及 `OFF`.
270+
请注意, `--verbose` 等同于 `--log-level=ALL` , 而 `--silent` 等同于 `--log-level=OFF`,
271+
因此, 本例只是一般性地设置日志级别:
267272

268273
{{< tabpane text=true >}}
269274
{{% tab header="Java" %}}
270275
{{< badge-version version="4.8" >}}
271276
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L127-L128" >}}
272-
**Note**: Java also allows setting log level by System Property:\
273-
Property key: `EdgeDriverService.EDGE_DRIVER_LOG_LEVEL_PROPERTY`\
274-
Property value: String representation of `ChromiumDriverLogLevel` enum
277+
**注意**: Java同样允许在系统属性中配置日志级别:\
278+
属性键: `EdgeDriverService.EDGE_DRIVER_LOG_LEVEL_PROPERTY`\
279+
属性值: String representation of `ChromiumDriverLogLevel` enum
275280
{{% /tab %}}
276281
{{< tab header="Python" >}}
277282
{{< gh-codeblock path="examples/python/tests/browsers/test_edge.py#L93" >}}
@@ -291,21 +296,21 @@ Property value: String representation of `ChromiumDriverLogLevel` enum
291296
{{< /tab >}}
292297
{{< /tabpane >}}
293298

294-
### Log file features
295-
There are 2 features that are only available when logging to a file:
296-
* append log
297-
* readable timestamps
299+
### 日志文件功能
300+
有 2 项功能只有在记录到文件时才可用:
301+
* 追加日志
302+
* 可读时间戳
298303

299-
To use them, you need to also explicitly specify the log path and log level.
300-
The log output will be managed by the driver, not the process, so minor differences may be seen.
304+
要使用它们, 还需要明确指定日志路径和日志级别.
305+
日志输出将由driver而非进程管理, 因此可能会出现细微差别.
301306

302307
{{< tabpane text=true >}}
303308
{{% tab header="Java" %}}
304309
{{< badge-version version="4.8" >}}
305310
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L143-L144" >}}
306-
**Note**: Java also allows toggling these features by System Property:\
307-
Property keys: `EdgeDriverService.EDGE_DRIVER_APPEND_LOG_PROPERTY` and `EdgeDriverService.EDGE_DRIVER_READABLE_TIMESTAMP`\
308-
Property value: `"true"` or `"false"`
311+
**注意**: Java同样允许在系统属性中配置开闭这些功能:\
312+
属性键: `EdgeDriverService.EDGE_DRIVER_APPEND_LOG_PROPERTY` 以及 `EdgeDriverService.EDGE_DRIVER_READABLE_TIMESTAMP`\
313+
属性值: `"true"` `"false"`
309314
{{% /tab %}}
310315
{{< tab header="Python" >}}
311316
{{< gh-codeblock path="examples/python/tests/browsers/test_edge.py#L104" >}}
@@ -325,19 +330,20 @@ Property value: `"true"` or `"false"`
325330
{{< /tab >}}
326331
{{< /tabpane >}}
327332

328-
### Disabling build check
333+
### 禁用构建检查
329334

330-
Edge browser and msedgedriver versions should match, and if they don't the driver will error.
331-
If you disable the build check, you can force the driver to be used with any version of Edge.
332-
Note that this is an unsupported feature, and bugs will not be investigated.
335+
Edge 浏览器和 msedgedriver 版本应该匹配,
336+
如果不匹配, 驱动程序就会出错.
337+
如果禁用构建检查, 则可以强制驱动程序与任何版本的 Edge 一起使用.
338+
请注意, 这是一项不受支持的功能, 而且不会对错误进行调查.
333339

334340
{{< tabpane text=true >}}
335341
{{% tab header="Java" %}}
336342
{{< badge-version version="4.8" >}}
337343
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L161-L162" >}}
338-
**Note**: Java also allows disabling build checks by System Property:\
339-
Property key: `EdgeDriverService.EDGE_DRIVER_DISABLE_BUILD_CHECK`\
340-
Property value: `"true"` or `"false"`
344+
**注意**: Java同样允许在系统属性中配置禁用构建检查:\
345+
属性键: `EdgeDriverService.EDGE_DRIVER_DISABLE_BUILD_CHECK`\
346+
属性值: `"true"` `"false"`
341347
{{% /tab %}}
342348
{{< tab header="Python" >}}
343349
{{< gh-codeblock path="examples/python/tests/browsers/test_edge.py#L115" >}}
@@ -360,17 +366,17 @@ Property value: `"true"` or `"false"`
360366

361367
## Internet Explorer 兼容模式
362368

363-
微软Edge可以被"Internet Explorer兼容模式"驱动,
369+
微软Edge可以被"Internet Explorer兼容模式"驱动,
364370
该模式使用Internet Explorer驱动类与微软Edge结合使用.
365371
阅读 [Internet Explorer 页面]({{< ref "internet_explorer.md" >}}) 了解更多详情.
366372

367373

368-
## Special Features
369-
Some browsers have implemented additional features that are unique to them.
374+
## 特殊功能
375+
某些浏览器实现了其特有的附加功能.
370376

371-
### Casting
377+
### Cast
372378

373-
You can drive Chrome Cast devices with Edge, including sharing tabs
379+
您可以使用 Edge 驱动 Chrome Cast 设备, 包括共享标签页
374380

375381
{{< tabpane text=true >}}
376382
{{< tab header="Java" >}}
@@ -393,9 +399,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
393399
{{< /tab >}}
394400
{{< /tabpane >}}
395401

396-
### Network conditions
402+
### 网络状况
397403

398-
You can simulate various network conditions.
404+
您可以模拟各种网络状况.
399405

400406
{{< tabpane text=true >}}
401407
{{< tab header="Java" >}}
@@ -418,7 +424,7 @@ You can simulate various network conditions.
418424
{{< /tab >}}
419425
{{< /tabpane >}}
420426

421-
### Logs
427+
### 日志
422428

423429
{{< tabpane text=true >}}
424430
{{< tab header="Java" >}}
@@ -441,7 +447,7 @@ You can simulate various network conditions.
441447
{{< /tab >}}
442448
{{< /tabpane >}}
443449

444-
### Permissions
450+
### 权限
445451

446452
{{< tabpane text=true >}}
447453
{{< tab header="Java" >}}
@@ -464,6 +470,6 @@ You can simulate various network conditions.
464470
{{< /tab >}}
465471
{{< /tabpane >}}
466472

467-
### DevTools
473+
### 开发者工具
468474

469-
See the [Chrome DevTools] section for more information about using DevTools in Edge
475+
有关在 Edge 中使用 DevTools 的更多信息, 请参阅 [Chrome DevTools] 部分.

0 commit comments

Comments
 (0)