selenium-webdriver 4.1.0 → 4.2.0
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 +506 -565
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/README.md +4 -4
- package/chrome.js +13 -10
- package/chromium.js +48 -9
- package/edge.js +10 -8
- package/example/google_search.js +1 -1
- package/firefox.js +32 -17
- package/index.js +4 -50
- package/io/exec.js +2 -1
- package/io/index.js +23 -21
- package/io/zip.js +1 -3
- package/lib/by.js +6 -6
- package/lib/capabilities.js +0 -8
- package/lib/command.js +1 -11
- package/lib/error.js +1 -20
- package/lib/http.js +66 -161
- package/lib/input.js +71 -5
- package/lib/promise.js +12 -17
- package/lib/proxy.js +15 -5
- package/lib/session.js +1 -1
- package/lib/until.js +14 -16
- package/lib/webdriver.js +151 -143
- package/net/index.js +15 -8
- package/net/portprober.js +4 -3
- package/package.json +2 -2
- package/remote/index.js +12 -9
- package/safari.js +3 -3
- package/testing/index.js +18 -13
- package/opera.js +0 -406
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2022 Software Freedom Conservancy (SFC)
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/NOTICE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Copyright 2011-
|
|
1
|
+
Copyright 2011-2022 Software Freedom Conservancy
|
|
2
2
|
Copyright 2004-2011 Selenium committers
|
package/README.md
CHANGED
|
@@ -33,10 +33,10 @@ The sample below and others are included in the `example` directory. You may
|
|
|
33
33
|
also find the tests for selenium-webdriver informative.
|
|
34
34
|
|
|
35
35
|
```javascript
|
|
36
|
-
const {Builder, By, Key, until} = require('selenium-webdriver');
|
|
36
|
+
const {Builder, Browser, By, Key, until} = require('selenium-webdriver');
|
|
37
37
|
|
|
38
38
|
(async function example() {
|
|
39
|
-
let driver = await new Builder().forBrowser(
|
|
39
|
+
let driver = await new Builder().forBrowser(Browser.FIREFOX).build();
|
|
40
40
|
try {
|
|
41
41
|
await driver.get('http://www.google.com/ncr');
|
|
42
42
|
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
@@ -60,7 +60,7 @@ const chrome = require('selenium-webdriver/chrome');
|
|
|
60
60
|
const firefox = require('selenium-webdriver/firefox');
|
|
61
61
|
|
|
62
62
|
let driver = new webdriver.Builder()
|
|
63
|
-
.forBrowser(
|
|
63
|
+
.forBrowser(webdriver.Browser.FIREFOX)
|
|
64
64
|
.setChromeOptions(/* ... */)
|
|
65
65
|
.setFirefoxOptions(/* ... */)
|
|
66
66
|
.build();
|
|
@@ -99,7 +99,7 @@ API:
|
|
|
99
99
|
|
|
100
100
|
```javascript
|
|
101
101
|
let driver = new webdriver.Builder()
|
|
102
|
-
.forBrowser(
|
|
102
|
+
.forBrowser(webdriver.Browser.FIREFOX)
|
|
103
103
|
.usingServer('http://localhost:4444/wd/hub')
|
|
104
104
|
.build();
|
|
105
105
|
```
|
package/chrome.js
CHANGED
|
@@ -236,10 +236,9 @@ class Driver extends chromium.Driver {
|
|
|
236
236
|
*/
|
|
237
237
|
static createSession(opt_config, opt_serviceExecutor) {
|
|
238
238
|
let caps = opt_config || new Options()
|
|
239
|
-
return /** @type {!Driver} */ (
|
|
240
|
-
caps,
|
|
241
|
-
|
|
242
|
-
))
|
|
239
|
+
return /** @type {!Driver} */ (
|
|
240
|
+
super.createSession(caps, opt_serviceExecutor)
|
|
241
|
+
)
|
|
243
242
|
}
|
|
244
243
|
}
|
|
245
244
|
|
|
@@ -287,9 +286,13 @@ Driver.getDefaultService = getDefaultService
|
|
|
287
286
|
Driver.prototype.VENDOR_COMMAND_PREFIX = 'goog'
|
|
288
287
|
|
|
289
288
|
// PUBLIC API
|
|
290
|
-
|
|
291
|
-
exports
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
289
|
+
|
|
290
|
+
module.exports = {
|
|
291
|
+
Driver: Driver,
|
|
292
|
+
Options,
|
|
293
|
+
ServiceBuilder ,
|
|
294
|
+
getDefaultService,
|
|
295
|
+
setDefaultService,
|
|
296
|
+
locateSynchronously
|
|
297
|
+
}
|
|
298
|
+
|
package/chromium.js
CHANGED
|
@@ -92,11 +92,13 @@ const Command = {
|
|
|
92
92
|
LAUNCH_APP: 'launchApp',
|
|
93
93
|
GET_NETWORK_CONDITIONS: 'getNetworkConditions',
|
|
94
94
|
SET_NETWORK_CONDITIONS: 'setNetworkConditions',
|
|
95
|
+
DELETE_NETWORK_CONDITIONS: 'deleteNetworkConditions',
|
|
95
96
|
SEND_DEVTOOLS_COMMAND: 'sendDevToolsCommand',
|
|
96
97
|
SEND_AND_GET_DEVTOOLS_COMMAND: 'sendAndGetDevToolsCommand',
|
|
97
98
|
SET_PERMISSION: 'setPermission',
|
|
98
99
|
GET_CAST_SINKS: 'getCastSinks',
|
|
99
100
|
SET_CAST_SINK_TO_USE: 'setCastSinkToUse',
|
|
101
|
+
START_CAST_DESKTOP_MIRRORING: 'startDesktopMirroring',
|
|
100
102
|
START_CAST_TAB_MIRRORING: 'setCastTabMirroring',
|
|
101
103
|
GET_CAST_ISSUE_MESSAGE: 'getCastIssueMessage',
|
|
102
104
|
STOP_CASTING: 'stopCasting',
|
|
@@ -105,6 +107,7 @@ const Command = {
|
|
|
105
107
|
/**
|
|
106
108
|
* Creates a command executor with support for Chromium's custom commands.
|
|
107
109
|
* @param {!Promise<string>} url The server's URL.
|
|
110
|
+
* @param vendorPrefix
|
|
108
111
|
* @return {!command.Executor} The new command executor.
|
|
109
112
|
*/
|
|
110
113
|
function createExecutor(url, vendorPrefix) {
|
|
@@ -135,6 +138,11 @@ function configureExecutor(executor, vendorPrefix) {
|
|
|
135
138
|
'POST',
|
|
136
139
|
'/session/:sessionId/chromium/network_conditions'
|
|
137
140
|
)
|
|
141
|
+
executor.defineCommand(
|
|
142
|
+
Command.DELETE_NETWORK_CONDITIONS,
|
|
143
|
+
'DELETE',
|
|
144
|
+
'/session/:sessionId/chromium/network_conditions'
|
|
145
|
+
)
|
|
138
146
|
executor.defineCommand(
|
|
139
147
|
Command.SEND_DEVTOOLS_COMMAND,
|
|
140
148
|
'POST',
|
|
@@ -160,6 +168,11 @@ function configureExecutor(executor, vendorPrefix) {
|
|
|
160
168
|
'POST',
|
|
161
169
|
`/session/:sessionId/${vendorPrefix}/cast/set_sink_to_use`
|
|
162
170
|
)
|
|
171
|
+
executor.defineCommand(
|
|
172
|
+
Command.START_CAST_DESKTOP_MIRRORING,
|
|
173
|
+
'POST',
|
|
174
|
+
`/session/:sessionId/${vendorPrefix}/cast/start_desktop_mirroring`
|
|
175
|
+
)
|
|
163
176
|
executor.defineCommand(
|
|
164
177
|
Command.START_CAST_TAB_MIRRORING,
|
|
165
178
|
'POST',
|
|
@@ -217,8 +230,8 @@ class ServiceBuilder extends remote.DriverService.Builder {
|
|
|
217
230
|
* Enables Chrome logging.
|
|
218
231
|
* @returns {!ServiceBuilder} A self reference.
|
|
219
232
|
*/
|
|
220
|
-
|
|
221
|
-
return this.addArguments('--enable-chrome-logs')
|
|
233
|
+
enableChromeLogging() {
|
|
234
|
+
return this.addArguments('--enable-chrome-logs')
|
|
222
235
|
}
|
|
223
236
|
|
|
224
237
|
/**
|
|
@@ -292,7 +305,7 @@ class Options extends Capabilities {
|
|
|
292
305
|
* @return {!Options} A self reference.
|
|
293
306
|
*/
|
|
294
307
|
debuggerAddress(address) {
|
|
295
|
-
this.options_.debuggerAddress = address
|
|
308
|
+
this.options_.debuggerAddress = address
|
|
296
309
|
return this
|
|
297
310
|
}
|
|
298
311
|
|
|
@@ -648,14 +661,12 @@ class Driver extends webdriver.WebDriver {
|
|
|
648
661
|
*/
|
|
649
662
|
static createSession(caps, opt_serviceExecutor) {
|
|
650
663
|
let executor
|
|
651
|
-
let onQuit
|
|
652
664
|
if (opt_serviceExecutor instanceof http.Executor) {
|
|
653
665
|
executor = opt_serviceExecutor
|
|
654
666
|
configureExecutor(executor, this.VENDOR_COMMAND_PREFIX)
|
|
655
667
|
} else {
|
|
656
668
|
let service = opt_serviceExecutor || this.getDefaultService()
|
|
657
669
|
executor = createExecutor(service.start(), this.VENDOR_COMMAND_PREFIX)
|
|
658
|
-
onQuit = () => service.kill()
|
|
659
670
|
}
|
|
660
671
|
|
|
661
672
|
// W3C spec requires noProxy value to be an array of strings, but Chromium
|
|
@@ -668,7 +679,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
668
679
|
}
|
|
669
680
|
}
|
|
670
681
|
|
|
671
|
-
return /** @type {!Driver} */ (super.createSession(executor, caps
|
|
682
|
+
return /** @type {!Driver} */ (super.createSession(executor, caps))
|
|
672
683
|
}
|
|
673
684
|
|
|
674
685
|
/**
|
|
@@ -699,6 +710,15 @@ class Driver extends webdriver.WebDriver {
|
|
|
699
710
|
return this.execute(new command.Command(Command.GET_NETWORK_CONDITIONS))
|
|
700
711
|
}
|
|
701
712
|
|
|
713
|
+
/**
|
|
714
|
+
* Schedules a command to delete Chromium network emulation settings.
|
|
715
|
+
* @return {!Promise} A promise that will be resolved when network
|
|
716
|
+
* emulation settings have been deleted.
|
|
717
|
+
*/
|
|
718
|
+
deleteNetworkConditions() {
|
|
719
|
+
return this.execute(new command.Command(Command.DELETE_NETWORK_CONDITIONS))
|
|
720
|
+
}
|
|
721
|
+
|
|
702
722
|
/**
|
|
703
723
|
* Schedules a command to set Chromium network emulation settings.
|
|
704
724
|
*
|
|
@@ -833,6 +853,23 @@ class Driver extends webdriver.WebDriver {
|
|
|
833
853
|
)
|
|
834
854
|
}
|
|
835
855
|
|
|
856
|
+
/**
|
|
857
|
+
* Initiates desktop mirroring for the current browser tab on the specified device.
|
|
858
|
+
*
|
|
859
|
+
* @param {String} deviceName name of the target device.
|
|
860
|
+
* @return {!promise.Thenable<void>} A promise that will be resolved
|
|
861
|
+
* when the mirror command has been issued to the device.
|
|
862
|
+
*/
|
|
863
|
+
startDesktopMirroring(deviceName) {
|
|
864
|
+
return this.schedule(
|
|
865
|
+
new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter(
|
|
866
|
+
'sinkName',
|
|
867
|
+
deviceName
|
|
868
|
+
),
|
|
869
|
+
'Driver.startDesktopMirroring(' + deviceName + ')'
|
|
870
|
+
)
|
|
871
|
+
}
|
|
872
|
+
|
|
836
873
|
/**
|
|
837
874
|
* Initiates tab mirroring for the current browser tab on the specified device.
|
|
838
875
|
*
|
|
@@ -882,6 +919,8 @@ class Driver extends webdriver.WebDriver {
|
|
|
882
919
|
|
|
883
920
|
// PUBLIC API
|
|
884
921
|
|
|
885
|
-
exports
|
|
886
|
-
|
|
887
|
-
|
|
922
|
+
module.exports = {
|
|
923
|
+
Driver,
|
|
924
|
+
Options,
|
|
925
|
+
ServiceBuilder,
|
|
926
|
+
}
|
package/edge.js
CHANGED
|
@@ -94,7 +94,7 @@ let defaultService = null
|
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
|
97
|
-
* a [
|
|
97
|
+
* a [MSEdgeDriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
|
|
98
98
|
* server in a child process.
|
|
99
99
|
*/
|
|
100
100
|
class ServiceBuilder extends chromium.ServiceBuilder {
|
|
@@ -130,7 +130,7 @@ class Options extends chromium.Options {
|
|
|
130
130
|
* The binary path be absolute or relative to the msedgedriver server
|
|
131
131
|
* executable, but it must exist on the machine that will launch edge chromium.
|
|
132
132
|
*
|
|
133
|
-
* @param {string} path The path to the
|
|
133
|
+
* @param {string} path The path to the msedgedriver binary to use.
|
|
134
134
|
* @return {!Options} A self reference.
|
|
135
135
|
*/
|
|
136
136
|
setEdgeChromiumBinaryPath(path) {
|
|
@@ -210,9 +210,11 @@ Driver.getDefaultService = getDefaultService
|
|
|
210
210
|
|
|
211
211
|
// PUBLIC API
|
|
212
212
|
|
|
213
|
-
exports
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
module.exports = {
|
|
214
|
+
Driver,
|
|
215
|
+
Options,
|
|
216
|
+
ServiceBuilder,
|
|
217
|
+
getDefaultService,
|
|
218
|
+
setDefaultService,
|
|
219
|
+
locateSynchronously,
|
|
220
|
+
}
|
package/example/google_search.js
CHANGED
package/firefox.js
CHANGED
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
|
|
117
117
|
'use strict'
|
|
118
118
|
|
|
119
|
+
const fs = require('fs')
|
|
119
120
|
const path = require('path')
|
|
120
121
|
const Symbols = require('./lib/symbols')
|
|
121
122
|
const command = require('./lib/command')
|
|
@@ -222,7 +223,7 @@ async function buildProfile(template, extensions) {
|
|
|
222
223
|
dir = await io.tmpDir()
|
|
223
224
|
if (template) {
|
|
224
225
|
await io.copyDir(
|
|
225
|
-
/** @type {string} */(template),
|
|
226
|
+
/** @type {string} */ (template),
|
|
226
227
|
dir,
|
|
227
228
|
/(parent\.lock|lock|\.parentlock)/
|
|
228
229
|
)
|
|
@@ -400,7 +401,11 @@ class Options extends Capabilities {
|
|
|
400
401
|
* @param {string} androidPackage The package to use
|
|
401
402
|
* @return {!Options} A self reference
|
|
402
403
|
*/
|
|
403
|
-
enableMobile(
|
|
404
|
+
enableMobile(
|
|
405
|
+
androidPackage = 'org.mozilla.firefox',
|
|
406
|
+
androidActivity = null,
|
|
407
|
+
deviceSerial = null
|
|
408
|
+
) {
|
|
404
409
|
this.firefoxOptions_().androidPackage = androidPackage
|
|
405
410
|
|
|
406
411
|
if (androidActivity) {
|
|
@@ -457,11 +462,11 @@ function findGeckoDriver() {
|
|
|
457
462
|
if (!exe) {
|
|
458
463
|
throw Error(
|
|
459
464
|
'The ' +
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
+
GECKO_DRIVER_EXE +
|
|
466
|
+
' executable could not be found on the current ' +
|
|
467
|
+
'PATH. Please download the latest version from ' +
|
|
468
|
+
'https://github.com/mozilla/geckodriver/releases/ ' +
|
|
469
|
+
'and ensure it can be found on your PATH.'
|
|
465
470
|
)
|
|
466
471
|
}
|
|
467
472
|
return exe
|
|
@@ -482,8 +487,8 @@ function findInProgramFiles(file) {
|
|
|
482
487
|
return exists
|
|
483
488
|
? files[0]
|
|
484
489
|
: io.exists(files[1]).then(function (exists) {
|
|
485
|
-
|
|
486
|
-
|
|
490
|
+
return exists ? files[1] : null
|
|
491
|
+
})
|
|
487
492
|
})
|
|
488
493
|
}
|
|
489
494
|
|
|
@@ -617,7 +622,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
617
622
|
* implementation.
|
|
618
623
|
* @override
|
|
619
624
|
*/
|
|
620
|
-
setFileDetector() {
|
|
625
|
+
setFileDetector() {}
|
|
621
626
|
|
|
622
627
|
/**
|
|
623
628
|
* Get the context that is currently in effect.
|
|
@@ -666,7 +671,15 @@ class Driver extends webdriver.WebDriver {
|
|
|
666
671
|
* @see #uninstallAddon
|
|
667
672
|
*/
|
|
668
673
|
async installAddon(path, temporary = false) {
|
|
669
|
-
let
|
|
674
|
+
let stats = fs.statSync(path)
|
|
675
|
+
let buf;
|
|
676
|
+
if (stats.isDirectory()) {
|
|
677
|
+
let zip = new Zip()
|
|
678
|
+
await zip.addDir(path)
|
|
679
|
+
buf = await zip.toBuffer('DEFLATE')
|
|
680
|
+
} else {
|
|
681
|
+
buf = await io.read(path)
|
|
682
|
+
}
|
|
670
683
|
return this.execute(
|
|
671
684
|
new command.Command(ExtensionCommand.INSTALL_ADDON)
|
|
672
685
|
.setParameter('addon', buf.toString('base64'))
|
|
@@ -805,9 +818,11 @@ Channel.NIGHTLY = new Channel(
|
|
|
805
818
|
|
|
806
819
|
// PUBLIC API
|
|
807
820
|
|
|
808
|
-
exports
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
821
|
+
module.exports = {
|
|
822
|
+
Channel,
|
|
823
|
+
Context,
|
|
824
|
+
Driver,
|
|
825
|
+
Options,
|
|
826
|
+
ServiceBuilder,
|
|
827
|
+
locateSynchronously,
|
|
828
|
+
}
|
package/index.js
CHANGED
|
@@ -38,14 +38,13 @@ const safari = require('./safari')
|
|
|
38
38
|
const session = require('./lib/session')
|
|
39
39
|
const until = require('./lib/until')
|
|
40
40
|
const webdriver = require('./lib/webdriver')
|
|
41
|
-
const opera = require('./opera')
|
|
42
41
|
|
|
43
42
|
const Browser = capabilities.Browser
|
|
44
43
|
const Capabilities = capabilities.Capabilities
|
|
45
44
|
const Capability = capabilities.Capability
|
|
46
45
|
const WebDriver = webdriver.WebDriver
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
let seleniumServer
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
50
|
* Starts an instance of the Selenium server if not yet running.
|
|
@@ -76,13 +75,12 @@ function startSeleniumServer(jar) {
|
|
|
76
75
|
* @return {function(new: webdriver.WebDriver, ...?)}
|
|
77
76
|
*/
|
|
78
77
|
function ensureFileDetectorsAreEnabled(ctor) {
|
|
79
|
-
|
|
78
|
+
return class extends ctor {
|
|
80
79
|
/** @param {input.FileDetector} detector */
|
|
81
|
-
setFileDetector(detector) {
|
|
80
|
+
setFileDetector (detector) {
|
|
82
81
|
webdriver.WebDriver.prototype.setFileDetector.call(this, detector)
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
return mixin
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
/**
|
|
@@ -233,12 +231,6 @@ class Builder {
|
|
|
233
231
|
|
|
234
232
|
/** @private {http.Agent} */
|
|
235
233
|
this.agent_ = null
|
|
236
|
-
|
|
237
|
-
/** @private {opera.Options} */
|
|
238
|
-
this.operaOptions_ = null
|
|
239
|
-
|
|
240
|
-
/** @private {remote.DriverService.Builder} */
|
|
241
|
-
this.operaService_ = null
|
|
242
234
|
}
|
|
243
235
|
|
|
244
236
|
/**
|
|
@@ -433,20 +425,6 @@ class Builder {
|
|
|
433
425
|
return this
|
|
434
426
|
}
|
|
435
427
|
|
|
436
|
-
/**
|
|
437
|
-
* Sets Opera specific {@linkplain opera.Options options} for drivers
|
|
438
|
-
* created by this builder. Any logging or proxy settings defined on the given
|
|
439
|
-
* options will take precedence over those set through
|
|
440
|
-
* {@link #setLoggingPrefs} and {@link #setProxy}, respectively.
|
|
441
|
-
*
|
|
442
|
-
* @param {!opera.Options} options The OperaDriver options to use.
|
|
443
|
-
* @return {!Builder} A self reference.
|
|
444
|
-
*/
|
|
445
|
-
setOperaOptions(options) {
|
|
446
|
-
this.operaOptions_ = options
|
|
447
|
-
return this
|
|
448
|
-
}
|
|
449
|
-
|
|
450
428
|
/**
|
|
451
429
|
* @return {chrome.Options} the Chrome specific options currently configured
|
|
452
430
|
* for this builder.
|
|
@@ -561,21 +539,6 @@ class Builder {
|
|
|
561
539
|
return this
|
|
562
540
|
}
|
|
563
541
|
|
|
564
|
-
/**
|
|
565
|
-
* Sets the {@link opera.ServiceBuilder} to use to manage the
|
|
566
|
-
* operaDriver child process when creating sessions locally.
|
|
567
|
-
*
|
|
568
|
-
* @param {opera.ServiceBuilder} service the service to use.
|
|
569
|
-
* @return {!Builder} a self reference.
|
|
570
|
-
*/
|
|
571
|
-
setOperaService(service) {
|
|
572
|
-
if (service && !(service instanceof opera.ServiceBuilder)) {
|
|
573
|
-
throw TypeError('not a opera.ServiceBuilder object')
|
|
574
|
-
}
|
|
575
|
-
this.operaService_ = service
|
|
576
|
-
return this
|
|
577
|
-
}
|
|
578
|
-
|
|
579
542
|
/**
|
|
580
543
|
* Sets Safari specific {@linkplain safari.Options options} for drivers
|
|
581
544
|
* created by this builder. Any logging settings defined on the given options
|
|
@@ -649,8 +612,6 @@ class Builder {
|
|
|
649
612
|
capabilities.merge(this.safariOptions_)
|
|
650
613
|
} else if (browser === Browser.EDGE && this.edgeOptions_) {
|
|
651
614
|
capabilities.merge(this.edgeOptions_)
|
|
652
|
-
} else if (browser === Browser.OPERA && this.operaOptions_) {
|
|
653
|
-
capabilities.merge(this.operaOptions_)
|
|
654
615
|
}
|
|
655
616
|
|
|
656
617
|
checkOptions(
|
|
@@ -737,14 +698,6 @@ class Builder {
|
|
|
737
698
|
return createDriver(edge.Driver, capabilities, service)
|
|
738
699
|
}
|
|
739
700
|
|
|
740
|
-
case Browser.OPERA: {
|
|
741
|
-
let service = null
|
|
742
|
-
if (this.operaService_) {
|
|
743
|
-
service = this.operaService_.build()
|
|
744
|
-
}
|
|
745
|
-
return createDriver(opera.Driver, capabilities, service)
|
|
746
|
-
}
|
|
747
|
-
|
|
748
701
|
case Browser.SAFARI:
|
|
749
702
|
return createDriver(safari.Driver, capabilities)
|
|
750
703
|
|
|
@@ -821,6 +774,7 @@ exports.Browser = capabilities.Browser
|
|
|
821
774
|
exports.Builder = Builder
|
|
822
775
|
exports.Button = input.Button
|
|
823
776
|
exports.By = by.By
|
|
777
|
+
exports.RelativeBy = by.RelativeBy
|
|
824
778
|
exports.withTagName = by.withTagName
|
|
825
779
|
exports.locateWith = by.locateWith
|
|
826
780
|
exports.Capabilities = capabilities.Capabilities
|
package/io/exec.js
CHANGED
|
@@ -76,7 +76,8 @@ class Result {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const COMMAND_RESULT =
|
|
79
|
+
const COMMAND_RESULT =
|
|
80
|
+
/** !WeakMap<!Command, !Promise<!Result>> */ new WeakMap()
|
|
80
81
|
const KILL_HOOK = /** !WeakMap<!Command, function(string)> */ new WeakMap()
|
|
81
82
|
|
|
82
83
|
/**
|
package/io/index.js
CHANGED
|
@@ -42,8 +42,6 @@ function checkedCall(fn) {
|
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// PUBLIC API
|
|
46
|
-
|
|
47
45
|
/**
|
|
48
46
|
* Recursively removes a directory and all of its contents. This is equivalent
|
|
49
47
|
* to {@code rm -rf} on a POSIX system.
|
|
@@ -114,18 +112,18 @@ function copyDir(src, dst, opt_exclude) {
|
|
|
114
112
|
files = files.filter(/** @type {function(string): boolean} */ (predicate))
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
|
|
115
|
+
const results = []
|
|
118
116
|
files.forEach(function (file) {
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
const stats = fs.statSync(file)
|
|
118
|
+
const target = path.join(dst, path.basename(file))
|
|
121
119
|
|
|
122
120
|
if (stats.isDirectory()) {
|
|
123
121
|
if (!fs.existsSync(target)) {
|
|
124
122
|
fs.mkdirSync(target, stats.mode)
|
|
125
123
|
}
|
|
126
|
-
results.push(
|
|
124
|
+
results.push(copyDir(file, target, predicate))
|
|
127
125
|
} else {
|
|
128
|
-
results.push(
|
|
126
|
+
results.push(copy(file, target))
|
|
129
127
|
}
|
|
130
128
|
})
|
|
131
129
|
|
|
@@ -137,7 +135,7 @@ function copyDir(src, dst, opt_exclude) {
|
|
|
137
135
|
* @param {string} aPath The path to test.
|
|
138
136
|
* @return {!Promise<boolean>} A promise for whether the file exists.
|
|
139
137
|
*/
|
|
140
|
-
|
|
138
|
+
function exists(aPath) {
|
|
141
139
|
return new Promise(function (fulfill, reject) {
|
|
142
140
|
let type = typeof aPath
|
|
143
141
|
if (type !== 'string') {
|
|
@@ -153,7 +151,7 @@ exports.exists = function (aPath) {
|
|
|
153
151
|
* @param {string} aPath The path to stat.
|
|
154
152
|
* @return {!Promise<!fs.Stats>} A promise for the file stats.
|
|
155
153
|
*/
|
|
156
|
-
|
|
154
|
+
function stat(aPath) {
|
|
157
155
|
return checkedCall((callback) => fs.stat(aPath, callback))
|
|
158
156
|
}
|
|
159
157
|
|
|
@@ -335,15 +333,19 @@ function walkDir(rootPath) {
|
|
|
335
333
|
}
|
|
336
334
|
|
|
337
335
|
// PUBLIC API
|
|
338
|
-
module.exports
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
336
|
+
module.exports = {
|
|
337
|
+
walkDir,
|
|
338
|
+
rmDir,
|
|
339
|
+
mkdirp,
|
|
340
|
+
mkdir,
|
|
341
|
+
write,
|
|
342
|
+
read,
|
|
343
|
+
findInPath,
|
|
344
|
+
tmpFile,
|
|
345
|
+
tmpDir,
|
|
346
|
+
unlink,
|
|
347
|
+
copy,
|
|
348
|
+
copyDir,
|
|
349
|
+
exists,
|
|
350
|
+
stat,
|
|
351
|
+
}
|
package/io/zip.js
CHANGED
package/lib/by.js
CHANGED
|
@@ -225,7 +225,7 @@ class By {
|
|
|
225
225
|
* @return {!By} The new locator.
|
|
226
226
|
*/
|
|
227
227
|
static tagName(name) {
|
|
228
|
-
return By
|
|
228
|
+
return new By('tag name', name)
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/**
|
|
@@ -424,10 +424,10 @@ function check(locator) {
|
|
|
424
424
|
// PUBLIC API
|
|
425
425
|
|
|
426
426
|
module.exports = {
|
|
427
|
-
By
|
|
428
|
-
RelativeBy
|
|
429
|
-
withTagName
|
|
430
|
-
locateWith
|
|
427
|
+
By,
|
|
428
|
+
RelativeBy,
|
|
429
|
+
withTagName,
|
|
430
|
+
locateWith,
|
|
431
|
+
escapeCss,
|
|
431
432
|
checkedLocator: check,
|
|
432
|
-
escapeCss: escapeCss
|
|
433
433
|
}
|
package/lib/capabilities.js
CHANGED
|
@@ -34,7 +34,6 @@ const Browser = {
|
|
|
34
34
|
FIREFOX: 'firefox',
|
|
35
35
|
INTERNET_EXPLORER: 'internet explorer',
|
|
36
36
|
SAFARI: 'safari',
|
|
37
|
-
OPERA: 'opera',
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
/**
|
|
@@ -282,13 +281,6 @@ class Capabilities {
|
|
|
282
281
|
return new Capabilities().setBrowserName(Browser.SAFARI)
|
|
283
282
|
}
|
|
284
283
|
|
|
285
|
-
/**
|
|
286
|
-
* @return {!Capabilities} A basic set of capabilities for Opera
|
|
287
|
-
*/
|
|
288
|
-
static opera() {
|
|
289
|
-
return new Capabilities().setBrowserName(Browser.OPERA)
|
|
290
|
-
}
|
|
291
|
-
|
|
292
284
|
/**
|
|
293
285
|
* @return {!Object<string, ?>} The JSON representation of this instance.
|
|
294
286
|
* Note, the returned object may contain nested promised values.
|
package/lib/command.js
CHANGED
|
@@ -83,7 +83,6 @@ class Command {
|
|
|
83
83
|
* will support.
|
|
84
84
|
* @enum {string}
|
|
85
85
|
*/
|
|
86
|
-
// TODO: Delete obsolete command names.
|
|
87
86
|
const Name = {
|
|
88
87
|
GET_SERVER_STATUS: 'getStatus',
|
|
89
88
|
|
|
@@ -115,14 +114,9 @@ const Name = {
|
|
|
115
114
|
CLEAR_ELEMENT: 'clearElement',
|
|
116
115
|
CLICK_ELEMENT: 'clickElement',
|
|
117
116
|
SEND_KEYS_TO_ELEMENT: 'sendKeysToElement',
|
|
118
|
-
SUBMIT_ELEMENT: 'submitElement',
|
|
119
117
|
|
|
120
118
|
GET_CURRENT_WINDOW_HANDLE: 'getCurrentWindowHandle',
|
|
121
119
|
GET_WINDOW_HANDLES: 'getWindowHandles',
|
|
122
|
-
GET_WINDOW_POSITION: 'getWindowPosition',
|
|
123
|
-
SET_WINDOW_POSITION: 'setWindowPosition',
|
|
124
|
-
GET_WINDOW_SIZE: 'getWindowSize',
|
|
125
|
-
SET_WINDOW_SIZE: 'setWindowSize',
|
|
126
120
|
GET_WINDOW_RECT: 'getWindowRect',
|
|
127
121
|
SET_WINDOW_RECT: 'setWindowRect',
|
|
128
122
|
MAXIMIZE_WINDOW: 'maximizeWindow',
|
|
@@ -146,17 +140,14 @@ const Name = {
|
|
|
146
140
|
IS_ELEMENT_SELECTED: 'isElementSelected',
|
|
147
141
|
IS_ELEMENT_ENABLED: 'isElementEnabled',
|
|
148
142
|
IS_ELEMENT_DISPLAYED: 'isElementDisplayed',
|
|
149
|
-
GET_ELEMENT_LOCATION: 'getElementLocation',
|
|
150
|
-
GET_ELEMENT_LOCATION_IN_VIEW: 'getElementLocationOnceScrolledIntoView',
|
|
151
143
|
GET_ELEMENT_RECT: 'getElementRect',
|
|
152
|
-
GET_ELEMENT_SIZE: 'getElementSize',
|
|
153
144
|
GET_ELEMENT_ATTRIBUTE: 'getElementAttribute',
|
|
145
|
+
GET_DOM_ATTRIBUTE: 'getDomAttribute',
|
|
154
146
|
GET_ELEMENT_VALUE_OF_CSS_PROPERTY: 'getElementValueOfCssProperty',
|
|
155
147
|
GET_ELEMENT_PROPERTY: 'getElementProperty',
|
|
156
148
|
|
|
157
149
|
SCREENSHOT: 'screenshot',
|
|
158
150
|
TAKE_ELEMENT_SCREENSHOT: 'takeElementScreenshot',
|
|
159
|
-
SET_SCRIPT_TIMEOUT: 'setScriptTimeout',
|
|
160
151
|
|
|
161
152
|
PRINT_PAGE: 'printPage',
|
|
162
153
|
|
|
@@ -175,7 +166,6 @@ const Name = {
|
|
|
175
166
|
|
|
176
167
|
GET_AVAILABLE_LOG_TYPES: 'getAvailableLogTypes',
|
|
177
168
|
GET_LOG: 'getLog',
|
|
178
|
-
GET_SESSION_LOGS: 'getSessionLogs',
|
|
179
169
|
|
|
180
170
|
// Non-standard commands used by the standalone Selenium server.
|
|
181
171
|
UPLOAD_FILE: 'uploadFile',
|