@@ -9,16 +9,15 @@ aliases: [
9
9
]
10
10
---
11
11
12
- By default, Selenium 4 is compatible with Chrome v75 and greater. Note that the version of
13
- the Chrome browser and the version of chromedriver must match the major version.
12
+ 默认情况下,Selenium 4与Chrome v75及更高版本兼容. 但是请注意Chrome浏览器的版本与chromedriver的主版本需要匹配.
14
13
15
14
## Options
16
15
17
- Capabilities common to all browsers are described on the [ Options page] ({{< ref "../drivers/options.md" >}}).
16
+ 所有浏览器的通用功能请看这 [ Options page] ({{< ref "../drivers/options.md" >}}).
18
17
19
- Capabilities unique to Chrome can be found at Google's page for [ Capabilities & ChromeOptions] ( https://chromedriver.chromium.org/capabilities )
18
+ Chrome浏览器的特有功能可以在谷歌的页面找到: [ Capabilities & ChromeOptions] ( https://chromedriver.chromium.org/capabilities )
20
19
21
- Starting a Chrome session with basic defined options looks like this :
20
+ 基于默认选项的Chrome浏览器会话看起来是这样 :
22
21
23
22
{{< tabpane code=false langEqualsHeader=true >}}
24
23
{{< tab header="Java" >}}
@@ -41,15 +40,14 @@ Starting a Chrome session with basic defined options looks like this:
41
40
{{< /tab >}}
42
41
{{< /tabpane >}}
43
42
44
- Here are a few common use cases with different capabilities :
43
+ 下面是一些不同功能的常见示例 :
45
44
46
- ### Arguments
45
+ ### 参数
47
46
48
- The ` args ` parameter is for a list of [ Command Line Switches] ( https://peter.sh/experiments/chromium-command-line-switches/ )
49
- used when starting the browser.
50
- Commonly used args include ` --start-maximized ` and ` --headless=new `
47
+ ` args ` 参数是启动浏览器时输入的[ 浏览器命令行参数] ( https://peter.sh/experiments/chromium-command-line-switches/ ) .
48
+ 常用的参数包括 ` --start-maximized ` 和 ` --headless=new `
51
49
52
- Add an argument to options :
50
+ 添加一个参数到选项中 :
53
51
54
52
{{< tabpane code=false langEqualsHeader=true >}}
55
53
{{< tab header="Java" >}}
@@ -72,12 +70,11 @@ Add an argument to options:
72
70
{{< /tab >}}
73
71
{{< /tabpane >}}
74
72
75
- ### Start browser in a specified location
73
+ ### 从指定位置启动浏览器
76
74
77
- The ` binary ` parameter takes the path of an alternate location of browser to use. With this parameter you can
78
- use chromedriver to drive various Chromium based browsers.
75
+ ` binary ` 参数接收一个使用浏览器的备用路径,通过这个参数你可以使用chromedriver 去驱动各种基于Chromium 内核的浏览器.
79
76
80
- Add a browser location to options :
77
+ 添加一个浏览器地址到选项中 :
81
78
82
79
{{< tabpane code=false langEqualsHeader=true >}}
83
80
{{< tab header="Java" >}}
@@ -100,19 +97,19 @@ Add a browser location to options:
100
97
{{< /tab >}}
101
98
{{< /tabpane >}}
102
99
103
- ### Add extensions
100
+ ### 添加扩展程序
104
101
105
- The ` extensions ` parameter accepts crx files
102
+ ` extensions ` 参数接受crx文件
106
103
107
- Add an extension to options :
104
+ 添加一个扩展程序到选项中 :
108
105
109
106
{{< alert-code />}}
110
107
111
- ### Keeping browser open
108
+ ### 保持浏览器的打开状态
112
109
113
- Setting the ` detach ` parameter to true will keep the browser open after the driver process has been quit .
110
+ 将 ` detach ` 参数设置为true将在驱动过程结束后保持浏览器的打开状态 .
114
111
115
- Ad a binary to options :
112
+ 添加一个布尔值到选项中 :
116
113
117
114
{{< tabpane code=false langEqualsHeader=true >}}
118
115
{{< tab header="Java" >}}
@@ -135,12 +132,12 @@ Ad a binary to options:
135
132
{{< /tab >}}
136
133
{{< /tabpane >}}
137
134
138
- ### Excluding arguments
135
+ ### 排除的参数
139
136
140
- Chrome adds various arguments, if you do not want those arguments added, pass them into ` excludeSwitches ` .
141
- A common example is to turn the popup blocker back on .
137
+ Chrome 添加了各种参数,如果你不希望添加某些参数,可以将其传入 ` excludeSwitches ` .
138
+ 一个常见的例子是重新打开弹出窗口阻止程序 .
142
139
143
- Set excluded arguments on options :
140
+ 设置排除参数至选项中 :
144
141
145
142
{{< tabpane code=false langEqualsHeader=true >}}
146
143
{{< tab header="Java" >}}
@@ -165,13 +162,13 @@ Set excluded arguments on options:
165
162
166
163
## Casting
167
164
168
- You can drive Chrome Cast devices, including sharing tabs
165
+ 你可以驱动 Chrome Cast 设备,包括共享选项卡
169
166
170
167
{{< alert-code />}}
171
168
172
- ## Network conditions
169
+ ## 网络条件
173
170
174
- You can simulate various network conditions .
171
+ 您可以模拟各种网络条件 .
175
172
176
173
{{< alert-code />}}
177
174
0 commit comments