selenium-webdriver 4.0.0-alpha.7 → 4.0.0-alpha.8
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/.eslintrc.js +27 -0
- package/.prettierrc +4 -0
- package/CHANGES.md +21 -0
- package/README.md +2 -0
- package/chrome.js +69 -79
- package/chromium.js +423 -161
- package/devtools/CDPConnection.js +37 -0
- package/devtools/generator/protocol-dts-generator.js +429 -0
- package/edge.js +57 -58
- package/firefox.js +200 -202
- 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 +34 -39
- package/io/index.js +141 -151
- package/io/zip.js +75 -65
- package/lib/actions.js +137 -120
- package/lib/atoms/find-elements.js +123 -0
- package/lib/atoms/get-attribute.js +79 -59
- package/lib/atoms/is-displayed.js +72 -72
- package/lib/atoms/make-atoms-module.js +13 -7
- package/lib/by.js +192 -65
- package/lib/capabilities.js +75 -84
- package/lib/command.js +17 -20
- package/lib/error.js +134 -168
- package/lib/http.js +321 -232
- package/lib/input.js +319 -296
- package/lib/logging.js +126 -137
- package/lib/promise.js +60 -66
- package/lib/proxy.js +31 -41
- package/lib/session.js +12 -15
- package/lib/symbols.js +3 -4
- package/lib/until.js +162 -162
- package/lib/webdriver.js +711 -530
- package/net/index.js +30 -36
- package/net/portprober.js +30 -143
- package/opera.js +406 -0
- package/package.json +14 -6
- package/proxy.js +2 -2
- package/remote/index.js +190 -187
- package/safari.js +40 -49
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
mocha: true,
|
|
4
|
+
node: true,
|
|
5
|
+
es6: true,
|
|
6
|
+
},
|
|
7
|
+
extends: ['eslint:recommended', 'plugin:node/recommended', 'prettier'],
|
|
8
|
+
plugins: ['prettier', 'no-only-tests'],
|
|
9
|
+
rules: {
|
|
10
|
+
'prettier/prettier': 'error',
|
|
11
|
+
'no-const-assign': 'error',
|
|
12
|
+
'no-this-before-super': 'error',
|
|
13
|
+
'no-undef': 'error',
|
|
14
|
+
'no-unreachable': 'error',
|
|
15
|
+
'no-unused-vars': [
|
|
16
|
+
'error',
|
|
17
|
+
{ varsIgnorePattern: '^_', args: 'all', argsIgnorePattern: '^_' },
|
|
18
|
+
],
|
|
19
|
+
'constructor-super': 'error',
|
|
20
|
+
'valid-typeof': 'error',
|
|
21
|
+
'no-only-tests/no-only-tests': 'error',
|
|
22
|
+
'node/no-unpublished-require': 'error',
|
|
23
|
+
'node/no-unsupported-features/es-syntax': 0,
|
|
24
|
+
'node/no-unsupported-features/node-builtins': 0,
|
|
25
|
+
'node/no-missing-import': 'error',
|
|
26
|
+
},
|
|
27
|
+
}
|
package/.prettierrc
ADDED
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## v4.0.0-alpha.8
|
|
2
|
+
|
|
3
|
+
* Rolling back native support for Opera Browser
|
|
4
|
+
* Added new ieOptions capabilities:
|
|
5
|
+
- fileUploadDialogTimeout
|
|
6
|
+
- setEdgePath
|
|
7
|
+
- setEdgeChromium
|
|
8
|
+
- setScrollBehavior
|
|
9
|
+
- For consistent naming, deprecating `addArguments(...args)` in favor of `addBrowserCommandSwitches(...args)`
|
|
10
|
+
|
|
11
|
+
* Added relative locators
|
|
12
|
+
* Added Chrome DevTools Protocol (CDP) support
|
|
13
|
+
* Added support for BASIC authentication.
|
|
14
|
+
* Added listener for DOM mutations.
|
|
15
|
+
* Added support for listening out for console log events.
|
|
16
|
+
* Added support listening js exceptions using CDP
|
|
17
|
+
|
|
18
|
+
### API Changes
|
|
19
|
+
|
|
20
|
+
* Added the 'opera' module
|
|
21
|
+
|
|
1
22
|
## v4.0.0-alpha.4
|
|
2
23
|
|
|
3
24
|
### Changes
|
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
|