selenium-webdriver 4.0.0-alpha.7 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +56 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +2 -0
- package/chrome.js +69 -79
- package/chromium.js +231 -164
- package/{lib/atoms/make-atoms-module.js → devtools/CDPConnection.js} +15 -9
- package/edge.js +104 -146
- package/example/chrome_android.js +45 -0
- package/example/chrome_mobile_emulation.js +46 -0
- package/example/firefox_channels.js +84 -0
- package/example/google_search.js +50 -0
- package/example/google_search_test.js +70 -0
- package/example/headless.js +63 -0
- package/example/logging.js +64 -0
- package/firefox.js +199 -200
- package/http/index.js +128 -116
- package/http/util.js +56 -64
- package/ie.js +180 -104
- package/index.js +246 -199
- package/io/exec.js +35 -40
- package/io/index.js +146 -157
- package/io/zip.js +75 -66
- package/lib/atoms/find-elements.js +123 -0
- package/lib/atoms/get-attribute.js +75 -59
- package/lib/atoms/is-displayed.js +72 -72
- package/lib/atoms/mutation-listener.js +55 -0
- package/lib/by.js +192 -65
- package/lib/capabilities.js +76 -86
- package/lib/command.js +19 -35
- package/lib/error.js +134 -168
- package/lib/http.js +308 -232
- package/lib/input.js +192 -453
- package/lib/logging.js +126 -137
- package/lib/promise.js +53 -71
- package/lib/proxy.js +31 -41
- package/lib/session.js +12 -15
- package/lib/symbols.js +3 -4
- package/lib/until.js +162 -160
- package/lib/webdriver.js +1014 -549
- package/net/index.js +30 -36
- package/net/portprober.js +30 -143
- package/opera.js +406 -0
- package/package.json +15 -7
- package/proxy.js +2 -2
- package/remote/index.js +189 -187
- package/safari.js +40 -49
- package/testing/index.js +504 -0
- package/lib/README +0 -5
- package/lib/actions.js +0 -609
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
## v4.0.0-beta.3
|
|
2
|
+
|
|
3
|
+
* Removed support for legacy actions.
|
|
4
|
+
This will also remove "Bride Mode" support, which was introduced to translate of action class to legacy API.
|
|
5
|
+
* Remove devtools support for v86,v87 and adding support for v89, v90, v91
|
|
6
|
+
* make isPromise() return boolean value for null and undefined cases (#6785)
|
|
7
|
+
* code cleanup (#9158)
|
|
8
|
+
* replacing asserts equal with strictEqual and deepEqual with deepStrictEqual
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## v4.0.0-beta.2
|
|
12
|
+
|
|
13
|
+
* Removed support for Edge legacy.
|
|
14
|
+
* Make the build silent for WebDriver Bidi generated code
|
|
15
|
+
* resolve file path correctly (#9223)
|
|
16
|
+
* Update example in edge.js (#9231)
|
|
17
|
+
* Use a flat namespace for selenium options for finding WebDriver Bidi endpoint
|
|
18
|
+
* Removing duplicate license text updated by update_copyright.js
|
|
19
|
+
* Updating copyright text
|
|
20
|
+
* Minor code cleanup
|
|
21
|
+
* Removing duplicate variable declaration of IE from capabilities
|
|
22
|
+
|
|
23
|
+
## v4.0.0-beta.1
|
|
24
|
+
|
|
25
|
+
* JS Binding support for WebDriver Bidi in Firefox
|
|
26
|
+
- This requires Firefox 87 and Geckodriver 0.29 to be able to work
|
|
27
|
+
* Update the supported CDP versions
|
|
28
|
+
* Update tmp package version (#9155)
|
|
29
|
+
* Adding support for /computedlabel (getAccessibleName) (#9073)
|
|
30
|
+
* Adding support for computedrole (#8990)
|
|
31
|
+
* Use subfolder for NPM package homepage (#8938)
|
|
32
|
+
* Fix typo: tracingCategories -> traceCategories (#8976)
|
|
33
|
+
* Package up mutation-listener for node. Fixes #8955
|
|
34
|
+
* Adding support for `print` endpoint (#8880)
|
|
35
|
+
|
|
36
|
+
## v4.0.0-alpha.8
|
|
37
|
+
|
|
38
|
+
* Rolling back native support for Opera Browser
|
|
39
|
+
* Added new ieOptions capabilities:
|
|
40
|
+
- fileUploadDialogTimeout
|
|
41
|
+
- setEdgePath
|
|
42
|
+
- setEdgeChromium
|
|
43
|
+
- setScrollBehavior
|
|
44
|
+
- For consistent naming, deprecating `addArguments(...args)` in favor of `addBrowserCommandSwitches(...args)`
|
|
45
|
+
|
|
46
|
+
* Added relative locators
|
|
47
|
+
* Added Chrome DevTools Protocol (CDP) support
|
|
48
|
+
* Added support for BASIC authentication.
|
|
49
|
+
* Added listener for DOM mutations.
|
|
50
|
+
* Added support for listening out for console log events.
|
|
51
|
+
* Added support listening js exceptions using CDP
|
|
52
|
+
|
|
53
|
+
### API Changes
|
|
54
|
+
|
|
55
|
+
* Added the 'opera' module
|
|
56
|
+
|
|
1
57
|
## v4.0.0-alpha.4
|
|
2
58
|
|
|
3
59
|
### Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2021 Software Freedom Conservancy (SFC)
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ Safari 10 before testing.
|
|
|
24
24
|
| Internet Explorer | [IEDriverServer.exe][release] |
|
|
25
25
|
| Edge | [MicrosoftWebDriver.msi][edge] |
|
|
26
26
|
| Firefox | [geckodriver(.exe)][geckodriver] |
|
|
27
|
+
| Opera | [operadriver(.exe)][operadriver] |
|
|
27
28
|
| Safari | [safaridriver] |
|
|
28
29
|
|
|
29
30
|
## Usage
|
|
@@ -225,3 +226,4 @@ under the License.
|
|
|
225
226
|
[release]: http://selenium-release.storage.googleapis.com/index.html
|
|
226
227
|
[users]: https://groups.google.com/forum/#!forum/selenium-users
|
|
227
228
|
[safaridriver]: https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_0.html#//apple_ref/doc/uid/TP40014305-CH11-DontLinkElementID_28
|
|
229
|
+
[operadriver]: https://github.com/operasoftware/operachromiumdriver/releases
|
package/chrome.js
CHANGED
|
@@ -125,14 +125,11 @@
|
|
|
125
125
|
* [webview]: https://developer.chrome.com/multidevice/webview/overview
|
|
126
126
|
*/
|
|
127
127
|
|
|
128
|
-
'use strict'
|
|
129
|
-
|
|
130
|
-
const http = require('./http');
|
|
131
|
-
const io = require('./io');
|
|
132
|
-
const {Browser, Capabilities} = require('./lib/capabilities');
|
|
133
|
-
const remote = require('./remote');
|
|
134
|
-
const chromium = require('./chromium');
|
|
128
|
+
'use strict'
|
|
135
129
|
|
|
130
|
+
const io = require('./io')
|
|
131
|
+
const { Browser } = require('./lib/capabilities')
|
|
132
|
+
const chromium = require('./chromium')
|
|
136
133
|
|
|
137
134
|
/**
|
|
138
135
|
* Name of the ChromeDriver executable.
|
|
@@ -140,19 +137,10 @@ const chromium = require('./chromium');
|
|
|
140
137
|
* @const
|
|
141
138
|
*/
|
|
142
139
|
const CHROMEDRIVER_EXE =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* _Synchronously_ attempts to locate the chromedriver executable on the current
|
|
148
|
-
* system.
|
|
149
|
-
*
|
|
150
|
-
* @return {?string} the located executable, or `null`.
|
|
151
|
-
*/
|
|
152
|
-
function locateSynchronously() {
|
|
153
|
-
return io.findInPath(CHROMEDRIVER_EXE, true);
|
|
154
|
-
}
|
|
140
|
+
process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver'
|
|
155
141
|
|
|
142
|
+
/** @type {remote.DriverService} */
|
|
143
|
+
let defaultService = null
|
|
156
144
|
|
|
157
145
|
/**
|
|
158
146
|
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
|
@@ -168,53 +156,19 @@ class ServiceBuilder extends chromium.ServiceBuilder {
|
|
|
168
156
|
* cannot be found on the PATH.
|
|
169
157
|
*/
|
|
170
158
|
constructor(opt_exe) {
|
|
171
|
-
let exe = opt_exe || locateSynchronously()
|
|
159
|
+
let exe = opt_exe || locateSynchronously()
|
|
172
160
|
if (!exe) {
|
|
173
161
|
throw Error(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
162
|
+
`The ChromeDriver could not be found on the current PATH. Please ` +
|
|
163
|
+
`download the latest version of the ChromeDriver from ` +
|
|
164
|
+
`http://chromedriver.storage.googleapis.com/index.html and ensure ` +
|
|
165
|
+
`it can be found on your PATH.`
|
|
166
|
+
)
|
|
178
167
|
}
|
|
179
|
-
|
|
180
|
-
super(exe);
|
|
168
|
+
super(exe)
|
|
181
169
|
}
|
|
182
170
|
}
|
|
183
171
|
|
|
184
|
-
|
|
185
|
-
/** @type {remote.DriverService} */
|
|
186
|
-
let defaultService = null;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Sets the default service to use for new ChromeDriver instances.
|
|
191
|
-
* @param {!remote.DriverService} service The service to use.
|
|
192
|
-
* @throws {Error} If the default service is currently running.
|
|
193
|
-
*/
|
|
194
|
-
function setDefaultService(service) {
|
|
195
|
-
if (defaultService && defaultService.isRunning()) {
|
|
196
|
-
throw Error(
|
|
197
|
-
'The previously configured ChromeDriver service is still running. ' +
|
|
198
|
-
'You must shut it down before you may adjust its configuration.');
|
|
199
|
-
}
|
|
200
|
-
defaultService = service;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Returns the default ChromeDriver service. If such a service has not been
|
|
206
|
-
* configured, one will be constructed using the default configuration for
|
|
207
|
-
* a ChromeDriver executable found on the system PATH.
|
|
208
|
-
* @return {!remote.DriverService} The default ChromeDriver service.
|
|
209
|
-
*/
|
|
210
|
-
function getDefaultService() {
|
|
211
|
-
if (!defaultService) {
|
|
212
|
-
defaultService = new ServiceBuilder().build();
|
|
213
|
-
}
|
|
214
|
-
return defaultService;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
172
|
/**
|
|
219
173
|
* Class for managing ChromeDriver specific options.
|
|
220
174
|
*/
|
|
@@ -231,7 +185,7 @@ class Options extends chromium.Options {
|
|
|
231
185
|
* @return {!Options} A self reference.
|
|
232
186
|
*/
|
|
233
187
|
setChromeBinaryPath(path) {
|
|
234
|
-
return this.setBinaryPath(path)
|
|
188
|
+
return this.setBinaryPath(path)
|
|
235
189
|
}
|
|
236
190
|
|
|
237
191
|
/**
|
|
@@ -241,7 +195,7 @@ class Options extends chromium.Options {
|
|
|
241
195
|
* @return {!Options} A self reference.
|
|
242
196
|
*/
|
|
243
197
|
androidChrome() {
|
|
244
|
-
return this.androidPackage('com.android.chrome')
|
|
198
|
+
return this.androidPackage('com.android.chrome')
|
|
245
199
|
}
|
|
246
200
|
|
|
247
201
|
/**
|
|
@@ -251,7 +205,7 @@ class Options extends chromium.Options {
|
|
|
251
205
|
* @return {!Options} A self reference.
|
|
252
206
|
*/
|
|
253
207
|
setChromeLogFile(path) {
|
|
254
|
-
return this.setBrowserLogFile(path)
|
|
208
|
+
return this.setBrowserLogFile(path)
|
|
255
209
|
}
|
|
256
210
|
|
|
257
211
|
/**
|
|
@@ -261,14 +215,10 @@ class Options extends chromium.Options {
|
|
|
261
215
|
* @return {!Options} A self reference.
|
|
262
216
|
*/
|
|
263
217
|
setChromeMinidumpPath(path) {
|
|
264
|
-
return this.setBrowserMinidumpPath(path)
|
|
218
|
+
return this.setBrowserMinidumpPath(path)
|
|
265
219
|
}
|
|
266
220
|
}
|
|
267
221
|
|
|
268
|
-
Options.prototype.CAPABILITY_KEY = 'goog:chromeOptions';
|
|
269
|
-
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME;
|
|
270
|
-
|
|
271
|
-
|
|
272
222
|
/**
|
|
273
223
|
* Creates a new WebDriver client for Chrome.
|
|
274
224
|
*/
|
|
@@ -285,21 +235,61 @@ class Driver extends chromium.Driver {
|
|
|
285
235
|
* @return {!Driver} A new driver instance.
|
|
286
236
|
*/
|
|
287
237
|
static createSession(opt_config, opt_serviceExecutor) {
|
|
288
|
-
let caps = opt_config || new Options()
|
|
289
|
-
return /** @type {!Driver} */(super.createSession(
|
|
238
|
+
let caps = opt_config || new Options()
|
|
239
|
+
return /** @type {!Driver} */ (super.createSession(
|
|
240
|
+
caps,
|
|
241
|
+
opt_serviceExecutor
|
|
242
|
+
))
|
|
290
243
|
}
|
|
291
244
|
}
|
|
292
245
|
|
|
293
|
-
|
|
294
|
-
|
|
246
|
+
/**
|
|
247
|
+
* _Synchronously_ attempts to locate the chromedriver executable on the current
|
|
248
|
+
* system.
|
|
249
|
+
*
|
|
250
|
+
* @return {?string} the located executable, or `null`.
|
|
251
|
+
*/
|
|
252
|
+
function locateSynchronously() {
|
|
253
|
+
return io.findInPath(CHROMEDRIVER_EXE, true)
|
|
254
|
+
}
|
|
295
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Sets the default service to use for new ChromeDriver instances.
|
|
258
|
+
* @param {!remote.DriverService} service The service to use.
|
|
259
|
+
* @throws {Error} If the default service is currently running.
|
|
260
|
+
*/
|
|
261
|
+
function setDefaultService(service) {
|
|
262
|
+
if (defaultService && defaultService.isRunning()) {
|
|
263
|
+
throw Error(
|
|
264
|
+
`The previously configured ChromeDriver service is still running. ` +
|
|
265
|
+
`You must shut it down before you may adjust its configuration.`
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
defaultService = service
|
|
269
|
+
}
|
|
296
270
|
|
|
297
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Returns the default ChromeDriver service. If such a service has not been
|
|
273
|
+
* configured, one will be constructed using the default configuration for
|
|
274
|
+
* a ChromeDriver executable found on the system PATH.
|
|
275
|
+
* @return {!remote.DriverService} The default ChromeDriver service.
|
|
276
|
+
*/
|
|
277
|
+
function getDefaultService() {
|
|
278
|
+
if (!defaultService) {
|
|
279
|
+
defaultService = new ServiceBuilder().build()
|
|
280
|
+
}
|
|
281
|
+
return defaultService
|
|
282
|
+
}
|
|
298
283
|
|
|
284
|
+
Options.prototype.CAPABILITY_KEY = 'goog:chromeOptions'
|
|
285
|
+
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME
|
|
286
|
+
Driver.getDefaultService = getDefaultService
|
|
287
|
+
Driver.prototype.VENDOR_COMMAND_PREFIX = 'goog'
|
|
299
288
|
|
|
300
|
-
|
|
301
|
-
exports.
|
|
302
|
-
exports.
|
|
303
|
-
exports.
|
|
304
|
-
exports.
|
|
305
|
-
exports.
|
|
289
|
+
// PUBLIC API
|
|
290
|
+
exports.Driver = Driver
|
|
291
|
+
exports.Options = Options
|
|
292
|
+
exports.ServiceBuilder = ServiceBuilder
|
|
293
|
+
exports.getDefaultService = getDefaultService
|
|
294
|
+
exports.setDefaultService = setDefaultService
|
|
295
|
+
exports.locateSynchronously = locateSynchronously
|