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/lib/capabilities.js
CHANGED
|
@@ -15,16 +15,14 @@
|
|
|
15
15
|
// specific language governing permissions and limitations
|
|
16
16
|
// under the License.
|
|
17
17
|
|
|
18
|
-
'use strict'
|
|
18
|
+
'use strict'
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @fileoverview Defines types related to describing the capabilities of a
|
|
22
22
|
* WebDriver session.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
const Symbols = require('./symbols');
|
|
27
|
-
|
|
25
|
+
const Symbols = require('./symbols')
|
|
28
26
|
|
|
29
27
|
/**
|
|
30
28
|
* Recognized browser names.
|
|
@@ -34,11 +32,10 @@ const Browser = {
|
|
|
34
32
|
CHROME: 'chrome',
|
|
35
33
|
EDGE: 'MicrosoftEdge',
|
|
36
34
|
FIREFOX: 'firefox',
|
|
37
|
-
IE: 'internet explorer',
|
|
38
35
|
INTERNET_EXPLORER: 'internet explorer',
|
|
39
36
|
SAFARI: 'safari',
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
OPERA: 'opera',
|
|
38
|
+
}
|
|
42
39
|
|
|
43
40
|
/**
|
|
44
41
|
* Strategies for waiting for [document readiness] after a navigation
|
|
@@ -65,9 +62,8 @@ const PageLoadStrategy = {
|
|
|
65
62
|
* Indicates WebDriver should wait for the document readiness state to
|
|
66
63
|
* be "complete" after navigation. This is the default page loading strategy.
|
|
67
64
|
*/
|
|
68
|
-
NORMAL: 'normal'
|
|
69
|
-
}
|
|
70
|
-
|
|
65
|
+
NORMAL: 'normal',
|
|
66
|
+
}
|
|
71
67
|
|
|
72
68
|
/**
|
|
73
69
|
* Common platform names. These platforms are not explicitly defined by the
|
|
@@ -79,30 +75,29 @@ const PageLoadStrategy = {
|
|
|
79
75
|
const Platform = {
|
|
80
76
|
LINUX: 'linux',
|
|
81
77
|
MAC: 'mac',
|
|
82
|
-
WINDOWS: 'windows'
|
|
83
|
-
}
|
|
84
|
-
|
|
78
|
+
WINDOWS: 'windows',
|
|
79
|
+
}
|
|
85
80
|
|
|
86
81
|
/**
|
|
87
82
|
* Record object defining the timeouts that apply to certain WebDriver actions.
|
|
88
83
|
*
|
|
89
84
|
* @record
|
|
90
85
|
*/
|
|
91
|
-
function Timeouts() {}
|
|
86
|
+
function Timeouts() { }
|
|
92
87
|
|
|
93
88
|
/**
|
|
94
89
|
* Defines when, in milliseconds, to interrupt a script that is being
|
|
95
90
|
* {@linkplain ./webdriver.IWebDriver#executeScript evaluated}.
|
|
96
91
|
* @type {number}
|
|
97
92
|
*/
|
|
98
|
-
Timeouts.prototype.script
|
|
93
|
+
Timeouts.prototype.script
|
|
99
94
|
|
|
100
95
|
/**
|
|
101
96
|
* The timeout, in milliseconds, to apply to navigation events along with the
|
|
102
97
|
* {@link PageLoadStrategy}.
|
|
103
98
|
* @type {number}
|
|
104
99
|
*/
|
|
105
|
-
Timeouts.prototype.pageLoad
|
|
100
|
+
Timeouts.prototype.pageLoad
|
|
106
101
|
|
|
107
102
|
/**
|
|
108
103
|
* The maximum amount of time, in milliseconds, to spend attempting to
|
|
@@ -110,8 +105,7 @@ Timeouts.prototype.pageLoad;
|
|
|
110
105
|
* current page.
|
|
111
106
|
* @type {number}
|
|
112
107
|
*/
|
|
113
|
-
Timeouts.prototype.implicit
|
|
114
|
-
|
|
108
|
+
Timeouts.prototype.implicit
|
|
115
109
|
|
|
116
110
|
/**
|
|
117
111
|
* The possible default actions a WebDriver session can take to respond to
|
|
@@ -136,9 +130,8 @@ const UserPromptHandler = {
|
|
|
136
130
|
*/
|
|
137
131
|
DISMISS_AND_NOTIFY: 'dismiss and notify',
|
|
138
132
|
/** All prompts should be left unhandled. */
|
|
139
|
-
IGNORE: 'ignore'
|
|
140
|
-
}
|
|
141
|
-
|
|
133
|
+
IGNORE: 'ignore',
|
|
134
|
+
}
|
|
142
135
|
|
|
143
136
|
/**
|
|
144
137
|
* The standard WebDriver capability keys.
|
|
@@ -147,7 +140,6 @@ const UserPromptHandler = {
|
|
|
147
140
|
* @see <https://w3c.github.io/webdriver/webdriver-spec.html#capabilities>
|
|
148
141
|
*/
|
|
149
142
|
const Capability = {
|
|
150
|
-
|
|
151
143
|
/**
|
|
152
144
|
* Indicates whether a WebDriver session implicitly trusts otherwise untrusted
|
|
153
145
|
* and self-signed TLS certificates during navigation.
|
|
@@ -213,13 +205,12 @@ const Capability = {
|
|
|
213
205
|
*/
|
|
214
206
|
UNHANDLED_PROMPT_BEHAVIOR: 'unhandledPromptBehavior',
|
|
215
207
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Defines the current session’s strict file interactability.
|
|
210
|
+
* Used to upload a file when strict file interactability is on
|
|
211
|
+
*/
|
|
212
|
+
STRICT_FILE_INTERACTABILITY: 'strictFileInteractability',
|
|
213
|
+
}
|
|
223
214
|
|
|
224
215
|
/**
|
|
225
216
|
* Converts a generic hash object to a map.
|
|
@@ -227,16 +218,15 @@ const Capability = {
|
|
|
227
218
|
* @return {!Map<string, ?>} The converted map.
|
|
228
219
|
*/
|
|
229
220
|
function toMap(hash) {
|
|
230
|
-
let m = new Map
|
|
221
|
+
let m = new Map()
|
|
231
222
|
for (let key in hash) {
|
|
232
|
-
if (
|
|
233
|
-
m.set(key, hash[key])
|
|
223
|
+
if (Object.prototype.hasOwnProperty.call(hash, key)) {
|
|
224
|
+
m.set(key, hash[key])
|
|
234
225
|
}
|
|
235
226
|
}
|
|
236
|
-
return m
|
|
227
|
+
return m
|
|
237
228
|
}
|
|
238
229
|
|
|
239
|
-
|
|
240
230
|
/**
|
|
241
231
|
* Describes a set of capabilities for a WebDriver session.
|
|
242
232
|
*/
|
|
@@ -247,47 +237,47 @@ class Capabilities {
|
|
|
247
237
|
*/
|
|
248
238
|
constructor(other = undefined) {
|
|
249
239
|
if (other instanceof Capabilities) {
|
|
250
|
-
other = other.map_
|
|
240
|
+
other = other.map_
|
|
251
241
|
} else if (other && !(other instanceof Map)) {
|
|
252
|
-
other = toMap(other)
|
|
242
|
+
other = toMap(other)
|
|
253
243
|
}
|
|
254
244
|
/** @private @const {!Map<string, ?>} */
|
|
255
|
-
this.map_ = new Map(other)
|
|
245
|
+
this.map_ = new Map(other)
|
|
256
246
|
}
|
|
257
247
|
|
|
258
248
|
/**
|
|
259
249
|
* @return {!Capabilities} A basic set of capabilities for Chrome.
|
|
260
250
|
*/
|
|
261
251
|
static chrome() {
|
|
262
|
-
return new Capabilities().setBrowserName(Browser.CHROME)
|
|
252
|
+
return new Capabilities().setBrowserName(Browser.CHROME)
|
|
263
253
|
}
|
|
264
254
|
|
|
265
255
|
/**
|
|
266
256
|
* @return {!Capabilities} A basic set of capabilities for Microsoft Edge.
|
|
267
257
|
*/
|
|
268
258
|
static edge() {
|
|
269
|
-
return new Capabilities().setBrowserName(Browser.EDGE)
|
|
259
|
+
return new Capabilities().setBrowserName(Browser.EDGE)
|
|
270
260
|
}
|
|
271
261
|
|
|
272
262
|
/**
|
|
273
263
|
* @return {!Capabilities} A basic set of capabilities for Firefox.
|
|
274
264
|
*/
|
|
275
265
|
static firefox() {
|
|
276
|
-
return new Capabilities().setBrowserName(Browser.FIREFOX)
|
|
266
|
+
return new Capabilities().setBrowserName(Browser.FIREFOX).set("moz:debuggerAddress", true)
|
|
277
267
|
}
|
|
278
268
|
|
|
279
269
|
/**
|
|
280
270
|
* @return {!Capabilities} A basic set of capabilities for Internet Explorer.
|
|
281
271
|
*/
|
|
282
272
|
static ie() {
|
|
283
|
-
return new Capabilities().setBrowserName(Browser.INTERNET_EXPLORER)
|
|
273
|
+
return new Capabilities().setBrowserName(Browser.INTERNET_EXPLORER)
|
|
284
274
|
}
|
|
285
275
|
|
|
286
276
|
/**
|
|
287
277
|
* @return {!Capabilities} A basic set of capabilities for Safari.
|
|
288
278
|
*/
|
|
289
279
|
static safari() {
|
|
290
|
-
return new Capabilities().setBrowserName(Browser.SAFARI)
|
|
280
|
+
return new Capabilities().setBrowserName(Browser.SAFARI)
|
|
291
281
|
}
|
|
292
282
|
|
|
293
283
|
/**
|
|
@@ -297,7 +287,7 @@ class Capabilities {
|
|
|
297
287
|
* Map).
|
|
298
288
|
*/
|
|
299
289
|
[Symbols.serialize]() {
|
|
300
|
-
return serialize(this)
|
|
290
|
+
return serialize(this)
|
|
301
291
|
}
|
|
302
292
|
|
|
303
293
|
/**
|
|
@@ -306,7 +296,7 @@ class Capabilities {
|
|
|
306
296
|
* @template T
|
|
307
297
|
*/
|
|
308
298
|
get(key) {
|
|
309
|
-
return this.map_.get(key)
|
|
299
|
+
return this.map_.get(key)
|
|
310
300
|
}
|
|
311
301
|
|
|
312
302
|
/**
|
|
@@ -314,19 +304,19 @@ class Capabilities {
|
|
|
314
304
|
* @return {boolean} whether this capability set has the specified key.
|
|
315
305
|
*/
|
|
316
306
|
has(key) {
|
|
317
|
-
return this.map_.has(key)
|
|
307
|
+
return this.map_.has(key)
|
|
318
308
|
}
|
|
319
309
|
|
|
320
310
|
/**
|
|
321
311
|
* @return {!Iterator<string>} an iterator of the keys set.
|
|
322
312
|
*/
|
|
323
313
|
keys() {
|
|
324
|
-
return this.map_.keys()
|
|
314
|
+
return this.map_.keys()
|
|
325
315
|
}
|
|
326
316
|
|
|
327
317
|
/** @return {number} The number of capabilities set. */
|
|
328
318
|
get size() {
|
|
329
|
-
return this.map_.size
|
|
319
|
+
return this.map_.size
|
|
330
320
|
}
|
|
331
321
|
|
|
332
322
|
/**
|
|
@@ -337,20 +327,20 @@ class Capabilities {
|
|
|
337
327
|
*/
|
|
338
328
|
merge(other) {
|
|
339
329
|
if (other) {
|
|
340
|
-
let otherMap
|
|
330
|
+
let otherMap
|
|
341
331
|
if (other instanceof Capabilities) {
|
|
342
|
-
otherMap = other.map_
|
|
332
|
+
otherMap = other.map_
|
|
343
333
|
} else if (other instanceof Map) {
|
|
344
|
-
otherMap = other
|
|
334
|
+
otherMap = other
|
|
345
335
|
} else {
|
|
346
|
-
otherMap = toMap(other)
|
|
336
|
+
otherMap = toMap(other)
|
|
347
337
|
}
|
|
348
338
|
otherMap.forEach((value, key) => {
|
|
349
|
-
this.set(key, value)
|
|
350
|
-
})
|
|
351
|
-
return this
|
|
339
|
+
this.set(key, value)
|
|
340
|
+
})
|
|
341
|
+
return this
|
|
352
342
|
} else {
|
|
353
|
-
throw new TypeError('no capabilities provided for merge')
|
|
343
|
+
throw new TypeError('no capabilities provided for merge')
|
|
354
344
|
}
|
|
355
345
|
}
|
|
356
346
|
|
|
@@ -360,7 +350,7 @@ class Capabilities {
|
|
|
360
350
|
* @param {string} key the capability key to delete.
|
|
361
351
|
*/
|
|
362
352
|
delete(key) {
|
|
363
|
-
this.map_.delete(key)
|
|
353
|
+
this.map_.delete(key)
|
|
364
354
|
}
|
|
365
355
|
|
|
366
356
|
/**
|
|
@@ -371,10 +361,10 @@ class Capabilities {
|
|
|
371
361
|
*/
|
|
372
362
|
set(key, value) {
|
|
373
363
|
if (typeof key !== 'string') {
|
|
374
|
-
throw new TypeError('Capability keys must be strings: ' + typeof key)
|
|
364
|
+
throw new TypeError('Capability keys must be strings: ' + typeof key)
|
|
375
365
|
}
|
|
376
|
-
this.map_.set(key, value)
|
|
377
|
-
return this
|
|
366
|
+
this.map_.set(key, value)
|
|
367
|
+
return this
|
|
378
368
|
}
|
|
379
369
|
|
|
380
370
|
/**
|
|
@@ -385,7 +375,7 @@ class Capabilities {
|
|
|
385
375
|
* @return {!Capabilities} a self reference.
|
|
386
376
|
*/
|
|
387
377
|
setAcceptInsecureCerts(accept) {
|
|
388
|
-
return this.set(Capability.ACCEPT_INSECURE_TLS_CERTS, accept)
|
|
378
|
+
return this.set(Capability.ACCEPT_INSECURE_TLS_CERTS, accept)
|
|
389
379
|
}
|
|
390
380
|
|
|
391
381
|
/**
|
|
@@ -393,7 +383,7 @@ class Capabilities {
|
|
|
393
383
|
* TLS certificates.
|
|
394
384
|
*/
|
|
395
385
|
getAcceptInsecureCerts() {
|
|
396
|
-
return this.get(Capability.ACCEPT_INSECURE_TLS_CERTS)
|
|
386
|
+
return this.get(Capability.ACCEPT_INSECURE_TLS_CERTS)
|
|
397
387
|
}
|
|
398
388
|
|
|
399
389
|
/**
|
|
@@ -403,7 +393,7 @@ class Capabilities {
|
|
|
403
393
|
* @return {!Capabilities} a self reference.
|
|
404
394
|
*/
|
|
405
395
|
setBrowserName(name) {
|
|
406
|
-
return this.set(Capability.BROWSER_NAME, name)
|
|
396
|
+
return this.set(Capability.BROWSER_NAME, name)
|
|
407
397
|
}
|
|
408
398
|
|
|
409
399
|
/**
|
|
@@ -411,7 +401,7 @@ class Capabilities {
|
|
|
411
401
|
* not set.
|
|
412
402
|
*/
|
|
413
403
|
getBrowserName() {
|
|
414
|
-
return this.get(Capability.BROWSER_NAME)
|
|
404
|
+
return this.get(Capability.BROWSER_NAME)
|
|
415
405
|
}
|
|
416
406
|
|
|
417
407
|
/**
|
|
@@ -421,7 +411,7 @@ class Capabilities {
|
|
|
421
411
|
* @return {!Capabilities} a self reference.
|
|
422
412
|
*/
|
|
423
413
|
setBrowserVersion(version) {
|
|
424
|
-
return this.set(Capability.BROWSER_VERSION, version)
|
|
414
|
+
return this.set(Capability.BROWSER_VERSION, version)
|
|
425
415
|
}
|
|
426
416
|
|
|
427
417
|
/**
|
|
@@ -429,7 +419,7 @@ class Capabilities {
|
|
|
429
419
|
* if not set.
|
|
430
420
|
*/
|
|
431
421
|
getBrowserVersion() {
|
|
432
|
-
return this.get(Capability.BROWSER_VERSION)
|
|
422
|
+
return this.get(Capability.BROWSER_VERSION)
|
|
433
423
|
}
|
|
434
424
|
|
|
435
425
|
/**
|
|
@@ -439,7 +429,7 @@ class Capabilities {
|
|
|
439
429
|
* @return {!Capabilities} a self reference.
|
|
440
430
|
*/
|
|
441
431
|
setPageLoadStrategy(strategy) {
|
|
442
|
-
return this.set(Capability.PAGE_LOAD_STRATEGY, strategy)
|
|
432
|
+
return this.set(Capability.PAGE_LOAD_STRATEGY, strategy)
|
|
443
433
|
}
|
|
444
434
|
|
|
445
435
|
/**
|
|
@@ -448,7 +438,7 @@ class Capabilities {
|
|
|
448
438
|
* @return {(string|undefined)} the page load strategy.
|
|
449
439
|
*/
|
|
450
440
|
getPageLoadStrategy() {
|
|
451
|
-
return this.get(Capability.PAGE_LOAD_STRATEGY)
|
|
441
|
+
return this.get(Capability.PAGE_LOAD_STRATEGY)
|
|
452
442
|
}
|
|
453
443
|
|
|
454
444
|
/**
|
|
@@ -458,7 +448,7 @@ class Capabilities {
|
|
|
458
448
|
* @return {!Capabilities} a self reference.
|
|
459
449
|
*/
|
|
460
450
|
setPlatform(platform) {
|
|
461
|
-
return this.set(Capability.PLATFORM_NAME, platform)
|
|
451
|
+
return this.set(Capability.PLATFORM_NAME, platform)
|
|
462
452
|
}
|
|
463
453
|
|
|
464
454
|
/**
|
|
@@ -466,7 +456,7 @@ class Capabilities {
|
|
|
466
456
|
* set.
|
|
467
457
|
*/
|
|
468
458
|
getPlatform() {
|
|
469
|
-
return this.get(Capability.PLATFORM_NAME)
|
|
459
|
+
return this.get(Capability.PLATFORM_NAME)
|
|
470
460
|
}
|
|
471
461
|
|
|
472
462
|
/**
|
|
@@ -478,7 +468,7 @@ class Capabilities {
|
|
|
478
468
|
* @return {!Capabilities} A self reference.
|
|
479
469
|
*/
|
|
480
470
|
setLoggingPrefs(prefs) {
|
|
481
|
-
return this.set(Capability.LOGGING_PREFS, prefs)
|
|
471
|
+
return this.set(Capability.LOGGING_PREFS, prefs)
|
|
482
472
|
}
|
|
483
473
|
|
|
484
474
|
/**
|
|
@@ -487,7 +477,7 @@ class Capabilities {
|
|
|
487
477
|
* @return {!Capabilities} A self reference.
|
|
488
478
|
*/
|
|
489
479
|
setProxy(proxy) {
|
|
490
|
-
return this.set(Capability.PROXY, proxy)
|
|
480
|
+
return this.set(Capability.PROXY, proxy)
|
|
491
481
|
}
|
|
492
482
|
|
|
493
483
|
/**
|
|
@@ -495,7 +485,7 @@ class Capabilities {
|
|
|
495
485
|
* undefined if not set.
|
|
496
486
|
*/
|
|
497
487
|
getProxy() {
|
|
498
|
-
return this.get(Capability.PROXY)
|
|
488
|
+
return this.get(Capability.PROXY)
|
|
499
489
|
}
|
|
500
490
|
|
|
501
491
|
/**
|
|
@@ -508,7 +498,7 @@ class Capabilities {
|
|
|
508
498
|
* @return {!Capabilities} A self reference.
|
|
509
499
|
*/
|
|
510
500
|
setAlertBehavior(behavior) {
|
|
511
|
-
return this.set(Capability.UNHANDLED_PROMPT_BEHAVIOR, behavior)
|
|
501
|
+
return this.set(Capability.UNHANDLED_PROMPT_BEHAVIOR, behavior)
|
|
512
502
|
}
|
|
513
503
|
|
|
514
504
|
/**
|
|
@@ -516,18 +506,20 @@ class Capabilities {
|
|
|
516
506
|
* to unhandled user prompts, or undefined if not set.
|
|
517
507
|
*/
|
|
518
508
|
getAlertBehavior() {
|
|
519
|
-
return this.get(Capability.UNHANDLED_PROMPT_BEHAVIOR)
|
|
509
|
+
return this.get(Capability.UNHANDLED_PROMPT_BEHAVIOR)
|
|
520
510
|
}
|
|
521
511
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
512
|
+
/**
|
|
513
|
+
* Sets the boolean flag configuration for this instance.
|
|
514
|
+
*/
|
|
525
515
|
setStrictFileInteractability(strictFileInteractability) {
|
|
526
|
-
return this.set(
|
|
516
|
+
return this.set(
|
|
517
|
+
Capability.STRICT_FILE_INTERACTABILITY,
|
|
518
|
+
strictFileInteractability
|
|
519
|
+
)
|
|
527
520
|
}
|
|
528
521
|
}
|
|
529
522
|
|
|
530
|
-
|
|
531
523
|
/**
|
|
532
524
|
* Serializes a capabilities object. This is defined as a standalone function
|
|
533
525
|
* so it may be type checked (where Capabilities[Symbols.serialize] has type
|
|
@@ -538,20 +530,18 @@ class Capabilities {
|
|
|
538
530
|
* Note, the returned object may contain nested promised values.
|
|
539
531
|
*/
|
|
540
532
|
function serialize(caps) {
|
|
541
|
-
let ret = {}
|
|
533
|
+
let ret = {}
|
|
542
534
|
for (let key of caps.keys()) {
|
|
543
|
-
let cap = caps.get(key)
|
|
535
|
+
let cap = caps.get(key)
|
|
544
536
|
if (cap !== undefined && cap !== null) {
|
|
545
|
-
ret[key] = cap
|
|
537
|
+
ret[key] = cap
|
|
546
538
|
}
|
|
547
539
|
}
|
|
548
|
-
return ret
|
|
540
|
+
return ret
|
|
549
541
|
}
|
|
550
542
|
|
|
551
|
-
|
|
552
543
|
// PUBLIC API
|
|
553
544
|
|
|
554
|
-
|
|
555
545
|
module.exports = {
|
|
556
546
|
Browser,
|
|
557
547
|
Capabilities,
|
|
@@ -560,4 +550,4 @@ module.exports = {
|
|
|
560
550
|
Platform,
|
|
561
551
|
Timeouts,
|
|
562
552
|
UserPromptHandler,
|
|
563
|
-
}
|
|
553
|
+
}
|
package/lib/command.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* @fileoverview Contains several classes for handling commands.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
'use strict'
|
|
22
|
+
'use strict'
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Describes a command to execute.
|
|
@@ -29,15 +29,15 @@ class Command {
|
|
|
29
29
|
/** @param {string} name The name of this command. */
|
|
30
30
|
constructor(name) {
|
|
31
31
|
/** @private {string} */
|
|
32
|
-
this.name_ = name
|
|
32
|
+
this.name_ = name
|
|
33
33
|
|
|
34
34
|
/** @private {!Object<*>} */
|
|
35
|
-
this.parameters_ = {}
|
|
35
|
+
this.parameters_ = {}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/** @return {string} This command's name. */
|
|
39
39
|
getName() {
|
|
40
|
-
return this.name_
|
|
40
|
+
return this.name_
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -47,8 +47,8 @@ class Command {
|
|
|
47
47
|
* @return {!Command} A self reference.
|
|
48
48
|
*/
|
|
49
49
|
setParameter(name, value) {
|
|
50
|
-
this.parameters_[name] = value
|
|
51
|
-
return this
|
|
50
|
+
this.parameters_[name] = value
|
|
51
|
+
return this
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -57,8 +57,8 @@ class Command {
|
|
|
57
57
|
* @return {!Command} A self reference.
|
|
58
58
|
*/
|
|
59
59
|
setParameters(parameters) {
|
|
60
|
-
this.parameters_ = parameters
|
|
61
|
-
return this
|
|
60
|
+
this.parameters_ = parameters
|
|
61
|
+
return this
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -67,18 +67,17 @@ class Command {
|
|
|
67
67
|
* @return {*} The parameter value, or undefined if it has not been set.
|
|
68
68
|
*/
|
|
69
69
|
getParameter(key) {
|
|
70
|
-
return this.parameters_[key]
|
|
70
|
+
return this.parameters_[key]
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @return {!Object<*>} The parameters to send with this command.
|
|
75
75
|
*/
|
|
76
76
|
getParameters() {
|
|
77
|
-
return this.parameters_
|
|
77
|
+
return this.parameters_
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
81
|
/**
|
|
83
82
|
* Enumeration of predefined names command names that all command processors
|
|
84
83
|
* will support.
|
|
@@ -109,6 +108,7 @@ const Name = {
|
|
|
109
108
|
GET_ACTIVE_ELEMENT: 'getActiveElement',
|
|
110
109
|
FIND_ELEMENT: 'findElement',
|
|
111
110
|
FIND_ELEMENTS: 'findElements',
|
|
111
|
+
FIND_ELEMENTS_RELATIVE: 'findElementsRelative',
|
|
112
112
|
FIND_CHILD_ELEMENT: 'findChildElement',
|
|
113
113
|
FIND_CHILD_ELEMENTS: 'findChildElements',
|
|
114
114
|
|
|
@@ -140,6 +140,8 @@ const Name = {
|
|
|
140
140
|
EXECUTE_ASYNC_SCRIPT: 'executeAsyncScript',
|
|
141
141
|
|
|
142
142
|
GET_ELEMENT_TEXT: 'getElementText',
|
|
143
|
+
GET_COMPUTED_ROLE: 'getAriaRole',
|
|
144
|
+
GET_COMPUTED_LABEL: 'getAccessibleName',
|
|
143
145
|
GET_ELEMENT_TAG_NAME: 'getElementTagName',
|
|
144
146
|
IS_ELEMENT_SELECTED: 'isElementSelected',
|
|
145
147
|
IS_ELEMENT_ENABLED: 'isElementEnabled',
|
|
@@ -156,6 +158,8 @@ const Name = {
|
|
|
156
158
|
TAKE_ELEMENT_SCREENSHOT: 'takeElementScreenshot',
|
|
157
159
|
SET_SCRIPT_TIMEOUT: 'setScriptTimeout',
|
|
158
160
|
|
|
161
|
+
PRINT_PAGE: 'printPage',
|
|
162
|
+
|
|
159
163
|
GET_TIMEOUT: 'getTimeout',
|
|
160
164
|
SET_TIMEOUT: 'setTimeout',
|
|
161
165
|
|
|
@@ -173,24 +177,7 @@ const Name = {
|
|
|
173
177
|
|
|
174
178
|
ACTIONS: 'actions',
|
|
175
179
|
CLEAR_ACTIONS: 'clearActions',
|
|
176
|
-
|
|
177
|
-
LEGACY_ACTION_CLICK: 'legacyAction:click',
|
|
178
|
-
LEGACY_ACTION_DOUBLE_CLICK: 'legacyAction:doubleclick',
|
|
179
|
-
LEGACY_ACTION_MOUSE_DOWN: 'legacyAction:mouseDown',
|
|
180
|
-
LEGACY_ACTION_MOUSE_UP: 'legacyAction:mouseUp',
|
|
181
|
-
LEGACY_ACTION_MOUSE_MOVE: 'legacyAction:mouseMove',
|
|
182
|
-
LEGACY_ACTION_SEND_KEYS: 'legacyAction:sendKeys',
|
|
183
|
-
LEGACY_ACTION_TOUCH_DOWN: 'legacyAction:touchDown',
|
|
184
|
-
LEGACY_ACTION_TOUCH_UP: 'legacyAction:touchUp',
|
|
185
|
-
LEGACY_ACTION_TOUCH_MOVE: 'legacyAction:touchMove',
|
|
186
|
-
LEGACY_ACTION_TOUCH_SCROLL: 'legacyAction:touchScroll',
|
|
187
|
-
LEGACY_ACTION_TOUCH_LONG_PRESS: 'legacyAction:touchLongPress',
|
|
188
|
-
LEGACY_ACTION_TOUCH_FLICK: 'legacyAction:touchFlick',
|
|
189
|
-
LEGACY_ACTION_TOUCH_SINGLE_TAP: 'legacyAction:singleTap',
|
|
190
|
-
LEGACY_ACTION_TOUCH_DOUBLE_TAP: 'legacyAction:doubleTap',
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
|
|
180
|
+
}
|
|
194
181
|
|
|
195
182
|
/**
|
|
196
183
|
* Handles the execution of WebDriver {@link Command commands}.
|
|
@@ -207,16 +194,13 @@ class Executor {
|
|
|
207
194
|
* @return {!Promise<?>} A promise that will be fulfilled with the command
|
|
208
195
|
* result.
|
|
209
196
|
*/
|
|
210
|
-
execute(command) {}
|
|
197
|
+
execute(command) {} // eslint-disable-line
|
|
211
198
|
}
|
|
212
199
|
|
|
213
|
-
|
|
214
|
-
|
|
215
200
|
// PUBLIC API
|
|
216
201
|
|
|
217
|
-
|
|
218
202
|
module.exports = {
|
|
219
203
|
Command: Command,
|
|
220
204
|
Name: Name,
|
|
221
|
-
Executor: Executor
|
|
222
|
-
}
|
|
205
|
+
Executor: Executor,
|
|
206
|
+
}
|