@@ -6,16 +6,16 @@ description: >-
6
6
这些是特定于微软Edge浏览器的功能和特性.
7
7
---
8
8
9
- 微软Edge是用Chromium实现的, 最早支持版本是v79.
9
+ 微软Edge是用Chromium实现的, 最早支持版本是v79.
10
10
与Chrome类似, Edge驱动的主版本号必须与Edge浏览器的主要版本匹配.
11
11
12
12
在 [ Chrome 页面] ({{< ref "chrome.md" >}}) 上找到的所有capabilities和选项也适用于Edge.
13
13
14
14
## 选项
15
15
16
- Capabilities common to all browsers are described on the [ Options page ] ({{< ref "../drivers/options.md" >}}).
16
+ 所有浏览器的共有功能在 [ Options 页面 ] ({{< ref "../drivers/options.md" >}}).
17
17
18
- Capabilities unique to Chromium are documented at Google's page for
18
+ Chromium独有的功能记录在谷歌的
19
19
[ Capabilities & ChromeOptions] ( https://chromedriver.chromium.org/capabilities )
20
20
21
21
使用基本定义的选项启动 Edge 会话如下所示:
@@ -41,16 +41,16 @@ Capabilities unique to Chromium are documented at Google's page for
41
41
{{< /tab >}}
42
42
{{< /tabpane >}}
43
43
44
- ### Arguments
44
+ ### 参数
45
45
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
+ 有两个很好的资源可用于研究这些参数 :
48
48
* [ Chrome Flags for Tooling] ( https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md )
49
49
* [ List of Chromium Command Line Switches] ( https://peter.sh/experiments/chromium-command-line-switches/ )
50
50
51
- Commonly used args include ` --start-maximized ` and ` --headless=new ` and ` --user-data-dir=... `
51
+ 常用参数包括 ` --start-maximized ` 、 ` --headless=new ` 和 ` --user-data-dir=... `
52
52
53
- Add an argument to options :
53
+ 为options添加参数 :
54
54
55
55
{{< tabpane text=true >}}
56
56
{{< tab header="Java" >}}
@@ -73,12 +73,12 @@ Add an argument to options:
73
73
{{< /tab >}}
74
74
{{< /tabpane >}}
75
75
76
- ### Start browser in a specified location
76
+ ### 在指定位置启动浏览器
77
77
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 的浏览器 .
80
80
81
- Add a browser location to options :
81
+ 在options中添加浏览器位置 :
82
82
83
83
{{< tabpane text=true >}}
84
84
{{< tab header="Java" >}}
@@ -101,13 +101,15 @@ Add a browser location to options:
101
101
{{< /tab >}}
102
102
{{< /tabpane >}}
103
103
104
- ### Add extensions
104
+ ### 添加扩展
105
105
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 ) .
109
106
110
- Add an extension to options:
107
+ ` extensions ` 参数接受 crx 文件.
108
+ 至于已解压的目录、中提到,
109
+ 请使用[ 本文] ( https://chromedriver.chromium.org/extensions ) 中提及的 ` load-extension ` .
110
+
111
+
112
+ 在options中添加扩展:
111
113
112
114
{{< tabpane text=true >}}
113
115
{{< tab header="Java" >}}
@@ -130,10 +132,11 @@ Add an extension to options:
130
132
{{< /tab >}}
131
133
{{< /tabpane >}}
132
134
133
- ### Keeping browser open
135
+ ### 保持浏览器打开
134
136
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
+ 就可以在进程结束后保持浏览器打开.
137
140
138
141
{{< tabpane text=true >}}
139
142
{{% tab header="Java" %}}
@@ -156,15 +159,15 @@ so long as the quit command is not sent to the driver.
156
159
{{< /tab >}}
157
160
{{< /tabpane >}}
158
161
159
- ### Excluding arguments
162
+ ### 排除参数
160
163
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
+ 默认参数的完整列表参考
165
168
[ Chromium Source Code] ( https://source.chromium.org/chromium/chromium/src/+/main:chrome/test/chromedriver/chrome_launcher.cc )
166
169
167
- Set excluded arguments on options :
170
+ 在options中设置排除参数 :
168
171
169
172
{{< tabpane text=true >}}
170
173
{{< tab header="Java" >}}
@@ -188,25 +191,26 @@ Set excluded arguments on options:
188
191
{{< /tabpane >}}
189
192
190
193
191
- ## Service
194
+ ## 服务
192
195
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" >}}) 页面 .
195
198
196
- ### Log output
199
+ ### 日志输出
197
200
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
+ 日志输出会被忽略, 除非用户显示指定.
200
204
201
- #### File output
205
+ #### 文件输出
202
206
203
- To change the logging output to save to a specific file :
207
+ 更改日志输出以保存到特定文件 :
204
208
205
209
{{< tabpane text=true >}}
206
210
{{% tab header="Java" %}}
207
211
{{< badge-version version="4.10" >}}
208
212
{{< 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同样允许在系统属性中配置文件输出 :\
210
214
Property key: ` EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY ` \
211
215
Property value: String representing path to log file
212
216
{{% /tab %}}
@@ -228,17 +232,17 @@ Property value: String representing path to log file
228
232
{{< /tab >}}
229
233
{{< /tabpane >}}
230
234
231
- #### Console output
235
+ #### 控制台输出
232
236
233
- To change the logging output to display in the console as STDOUT :
237
+ 要更改日志输出, 使其在控制台中显示为标准输出 :
234
238
235
239
{{< tabpane text=true >}}
236
240
{{% tab header="Java" %}}
237
241
{{< badge-version version="4.10" >}}
238
242
{{< 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 `
242
246
{{% /tab %}}
243
247
{{< tab header="Python" >}}
244
248
{{< badge-version version="4.11" >}}
@@ -260,18 +264,19 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
260
264
{{< /tab >}}
261
265
{{< /tabpane >}}
262
266
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
+ 因此, 本例只是一般性地设置日志级别:
267
272
268
273
{{< tabpane text=true >}}
269
274
{{% tab header="Java" %}}
270
275
{{< badge-version version="4.8" >}}
271
276
{{< 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
275
280
{{% /tab %}}
276
281
{{< tab header="Python" >}}
277
282
{{< gh-codeblock path="examples/python/tests/browsers/test_edge.py#L93" >}}
@@ -291,21 +296,21 @@ Property value: String representation of `ChromiumDriverLogLevel` enum
291
296
{{< /tab >}}
292
297
{{< /tabpane >}}
293
298
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
+ * 可读时间戳
298
303
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而非进程管理, 因此可能会出现细微差别 .
301
306
302
307
{{< tabpane text=true >}}
303
308
{{% tab header="Java" %}}
304
309
{{< badge-version version="4.8" >}}
305
310
{{< 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" `
309
314
{{% /tab %}}
310
315
{{< tab header="Python" >}}
311
316
{{< gh-codeblock path="examples/python/tests/browsers/test_edge.py#L104" >}}
@@ -325,19 +330,20 @@ Property value: `"true"` or `"false"`
325
330
{{< /tab >}}
326
331
{{< /tabpane >}}
327
332
328
- ### Disabling build check
333
+ ### 禁用构建检查
329
334
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
+ 请注意, 这是一项不受支持的功能, 而且不会对错误进行调查.
333
339
334
340
{{< tabpane text=true >}}
335
341
{{% tab header="Java" %}}
336
342
{{< badge-version version="4.8" >}}
337
343
{{< 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" `
341
347
{{% /tab %}}
342
348
{{< tab header="Python" >}}
343
349
{{< gh-codeblock path="examples/python/tests/browsers/test_edge.py#L115" >}}
@@ -360,17 +366,17 @@ Property value: `"true"` or `"false"`
360
366
361
367
## Internet Explorer 兼容模式
362
368
363
- 微软Edge可以被"Internet Explorer兼容模式"驱动,
369
+ 微软Edge可以被"Internet Explorer兼容模式"驱动,
364
370
该模式使用Internet Explorer驱动类与微软Edge结合使用.
365
371
阅读 [ Internet Explorer 页面] ({{< ref "internet_explorer.md" >}}) 了解更多详情.
366
372
367
373
368
- ## Special Features
369
- Some browsers have implemented additional features that are unique to them .
374
+ ## 特殊功能
375
+ 某些浏览器实现了其特有的附加功能 .
370
376
371
- ### Casting
377
+ ### Cast
372
378
373
- You can drive Chrome Cast devices with Edge, including sharing tabs
379
+ 您可以使用 Edge 驱动 Chrome Cast 设备, 包括共享标签页
374
380
375
381
{{< tabpane text=true >}}
376
382
{{< tab header="Java" >}}
@@ -393,9 +399,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
393
399
{{< /tab >}}
394
400
{{< /tabpane >}}
395
401
396
- ### Network conditions
402
+ ### 网络状况
397
403
398
- You can simulate various network conditions .
404
+ 您可以模拟各种网络状况 .
399
405
400
406
{{< tabpane text=true >}}
401
407
{{< tab header="Java" >}}
@@ -418,7 +424,7 @@ You can simulate various network conditions.
418
424
{{< /tab >}}
419
425
{{< /tabpane >}}
420
426
421
- ### Logs
427
+ ### 日志
422
428
423
429
{{< tabpane text=true >}}
424
430
{{< tab header="Java" >}}
@@ -441,7 +447,7 @@ You can simulate various network conditions.
441
447
{{< /tab >}}
442
448
{{< /tabpane >}}
443
449
444
- ### Permissions
450
+ ### 权限
445
451
446
452
{{< tabpane text=true >}}
447
453
{{< tab header="Java" >}}
@@ -464,6 +470,6 @@ You can simulate various network conditions.
464
470
{{< /tab >}}
465
471
{{< /tabpane >}}
466
472
467
- ### DevTools
473
+ ### 开发者工具
468
474
469
- See the [ Chrome DevTools] section for more information about using DevTools in Edge
475
+ 有关在 Edge 中使用 DevTools 的更多信息, 请参阅 [ Chrome DevTools] 部分.
0 commit comments