selenium-webdriver 4.0.0-beta.1 → 4.0.0-rc-1
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 +46 -0
- package/README.md +4 -2
- package/chrome.js +3 -4
- package/chromium.js +38 -2
- package/devtools/CDPConnection.js +16 -18
- package/edge.js +84 -131
- package/firefox.js +18 -1
- package/http/index.js +25 -3
- package/ie.js +8 -8
- package/index.js +11 -8
- package/io/exec.js +5 -4
- package/io/index.js +8 -9
- package/io/zip.js +5 -6
- package/lib/atoms/find-elements.js +77 -78
- package/lib/atoms/get-attribute.js +64 -68
- package/lib/atoms/is-displayed.js +27 -27
- package/lib/atoms/mutation-listener.js +17 -0
- package/lib/by.js +39 -20
- package/lib/capabilities.js +10 -2
- package/lib/command.js +0 -15
- package/lib/http.js +2 -30
- package/lib/input.js +6 -301
- package/lib/promise.js +4 -16
- package/lib/until.js +14 -16
- package/lib/webdriver.js +58 -19
- package/opera.js +3 -3
- package/package.json +11 -11
- package/remote/index.js +8 -9
- package/safari.js +3 -3
- package/testing/index.js +14 -19
- package/lib/actions.js +0 -627
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
## v4.0.0-rc-1
|
|
2
|
+
|
|
3
|
+
* Deprecates withCapabilities method and removes tests (#9701)
|
|
4
|
+
* expose `withLocator` method at the top level
|
|
5
|
+
* Enables Mobile feature for Firefox (Still need to expand this to chromium based browsers)
|
|
6
|
+
|
|
7
|
+
* Add the ability to do Relative Locators with all By types. Fixes #9559
|
|
8
|
+
* Add default Opera capabilities. Fixes #9654
|
|
9
|
+
* Add support for ChromeDriver `--enable-chrome-logs` (#9575) [Author: Mark Stacey]
|
|
10
|
+
|
|
11
|
+
The `--enable-chrome-logs` ChromeDriver option can now be enabled using
|
|
12
|
+
the Chromium (or Chrome) ServiceBuilder, similarly to the other options
|
|
13
|
+
provided by ChromeDriver.
|
|
14
|
+
|
|
15
|
+
* Add the debuggerAddress option to chromium.js (#9561) [Author: Brandon Walderman]
|
|
16
|
+
* Adds http client options (#9638)[Author: Dharin Shah]
|
|
17
|
+
* Updating edge.js to extend chromium.driver (fixes #9626)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## v4.0.0-beta.4
|
|
21
|
+
|
|
22
|
+
* Add windowTypes option support for ChromiumDriver (#7897)
|
|
23
|
+
* Allow relativeby with findElement (#9396)
|
|
24
|
+
|
|
25
|
+
## v4.0.0-beta.3
|
|
26
|
+
|
|
27
|
+
* Removed support for legacy actions.
|
|
28
|
+
This will also remove "Bride Mode" support, which was introduced to translate of action class to legacy API.
|
|
29
|
+
* Remove devtools support for v86,v87 and adding support for v89, v90, v91
|
|
30
|
+
* make isPromise() return boolean value for null and undefined cases (#6785)
|
|
31
|
+
* code cleanup (#9158)
|
|
32
|
+
* replacing asserts equal with strictEqual and deepEqual with deepStrictEqual
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## v4.0.0-beta.2
|
|
36
|
+
|
|
37
|
+
* Removed support for Edge legacy.
|
|
38
|
+
* Make the build silent for WebDriver Bidi generated code
|
|
39
|
+
* resolve file path correctly (#9223)
|
|
40
|
+
* Update example in edge.js (#9231)
|
|
41
|
+
* Use a flat namespace for selenium options for finding WebDriver Bidi endpoint
|
|
42
|
+
* Removing duplicate license text updated by update_copyright.js
|
|
43
|
+
* Updating copyright text
|
|
44
|
+
* Minor code cleanup
|
|
45
|
+
* Removing duplicate variable declaration of IE from capabilities
|
|
46
|
+
|
|
1
47
|
## v4.0.0-beta.1
|
|
2
48
|
|
|
3
49
|
* JS Binding support for WebDriver Bidi in Firefox
|
package/README.md
CHANGED
|
@@ -223,7 +223,9 @@ under the License.
|
|
|
223
223
|
[edge]: http://go.microsoft.com/fwlink/?LinkId=619687
|
|
224
224
|
[geckodriver]: https://github.com/mozilla/geckodriver/releases/
|
|
225
225
|
[reduction]: http://www.webkit.org/quality/reduction.html
|
|
226
|
-
|
|
226
|
+
|
|
227
|
+
[release]: https://www.selenium.dev/downloads/
|
|
228
|
+
|
|
227
229
|
[users]: https://groups.google.com/forum/#!forum/selenium-users
|
|
228
230
|
[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
|
|
231
|
+
[operadriver]: https://github.com/operasoftware/operachromiumdriver/releases
|
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
|
|
package/chromium.js
CHANGED
|
@@ -213,6 +213,14 @@ class ServiceBuilder extends remote.DriverService.Builder {
|
|
|
213
213
|
return this.addArguments('--log-path=' + path)
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Enables Chrome logging.
|
|
218
|
+
* @returns {!ServiceBuilder} A self reference.
|
|
219
|
+
*/
|
|
220
|
+
enableChromeLogging() {
|
|
221
|
+
return this.addArguments('--enable-chrome-logs');
|
|
222
|
+
}
|
|
223
|
+
|
|
216
224
|
/**
|
|
217
225
|
* Enables verbose logging.
|
|
218
226
|
* @return {!ServiceBuilder} A self reference.
|
|
@@ -275,6 +283,19 @@ class Options extends Capabilities {
|
|
|
275
283
|
return this
|
|
276
284
|
}
|
|
277
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Sets the address of a Chromium remote debugging server to connect to.
|
|
288
|
+
* Address should be of the form "{hostname|IP address}:port"
|
|
289
|
+
* (e.g. "localhost:9222").
|
|
290
|
+
*
|
|
291
|
+
* @param {string} address The address to connect to.
|
|
292
|
+
* @return {!Options} A self reference.
|
|
293
|
+
*/
|
|
294
|
+
debuggerAddress(address) {
|
|
295
|
+
this.options_.debuggerAddress = address;
|
|
296
|
+
return this
|
|
297
|
+
}
|
|
298
|
+
|
|
278
299
|
/**
|
|
279
300
|
* Configures the driver to start the browser in headless mode.
|
|
280
301
|
*
|
|
@@ -549,6 +570,21 @@ class Options extends Capabilities {
|
|
|
549
570
|
return this
|
|
550
571
|
}
|
|
551
572
|
|
|
573
|
+
/**
|
|
574
|
+
* Sets a list of the window types that will appear when getting window
|
|
575
|
+
* handles. For access to <webview> elements, include "webview" in the list.
|
|
576
|
+
* @param {...(string|!Array<string>)} args The window types that will appear
|
|
577
|
+
* when getting window handles.
|
|
578
|
+
* @return {!Options} A self reference.
|
|
579
|
+
*/
|
|
580
|
+
windowTypes(...args) {
|
|
581
|
+
let windowTypes = (this.options_.windowTypes || []).concat(...args)
|
|
582
|
+
if (windowTypes.length) {
|
|
583
|
+
this.options_.windowTypes = windowTypes
|
|
584
|
+
}
|
|
585
|
+
return this
|
|
586
|
+
}
|
|
587
|
+
|
|
552
588
|
/**
|
|
553
589
|
* Converts this instance to its JSON wire protocol representation. Note this
|
|
554
590
|
* function is an implementation not intended for general use.
|
|
@@ -565,7 +601,7 @@ class Options extends Capabilities {
|
|
|
565
601
|
return extension.toString('base64')
|
|
566
602
|
}
|
|
567
603
|
return io
|
|
568
|
-
.read(/** @type {string} */(extension))
|
|
604
|
+
.read(/** @type {string} */ (extension))
|
|
569
605
|
.then((buffer) => buffer.toString('base64'))
|
|
570
606
|
})
|
|
571
607
|
}
|
|
@@ -618,7 +654,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
618
654
|
* implementation.
|
|
619
655
|
* @override
|
|
620
656
|
*/
|
|
621
|
-
setFileDetector() {
|
|
657
|
+
setFileDetector() {}
|
|
622
658
|
|
|
623
659
|
/**
|
|
624
660
|
* Schedules a command to launch Chrome App with given ID.
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* under the License.
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
19
17
|
|
|
20
18
|
class CDPConnection {
|
|
21
19
|
constructor(wsConnection) {
|
package/edge.js
CHANGED
|
@@ -17,23 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @fileoverview Defines a {@linkplain Driver WebDriver} client for
|
|
20
|
-
* Microsoft's Edge web browser.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* server.
|
|
20
|
+
* Microsoft's Edge web browser. Edge (Chromium) is supported and support
|
|
21
|
+
* for Edge Legacy (EdgeHTML) as part of https://github.com/SeleniumHQ/selenium/issues/9166.
|
|
22
|
+
* Before using this module, you must download and install the correct
|
|
23
|
+
* [WebDriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) server.
|
|
24
24
|
*
|
|
25
|
-
* Ensure that the
|
|
26
|
-
* is on your [PATH](http://en.wikipedia.org/wiki/PATH_%28variable%29).
|
|
27
|
-
* and Edge Legacy (EdgeHTML) will be used by default.
|
|
25
|
+
* Ensure that the msedgedriver (Chromium)
|
|
26
|
+
* is on your [PATH](http://en.wikipedia.org/wiki/PATH_%28variable%29).
|
|
28
27
|
*
|
|
29
|
-
* You may use {@link Options} to specify whether Edge Chromium should be used:
|
|
28
|
+
* You may use {@link Options} to specify whether Edge Chromium options should be used:
|
|
30
29
|
|
|
31
|
-
*
|
|
32
|
-
* options.
|
|
33
|
-
* // configure browser options ...
|
|
30
|
+
* const edge = require('selenium-webdriver/edge');
|
|
31
|
+
* const options = new edge.Options();
|
|
34
32
|
|
|
35
|
-
* Note that Chromium-specific {@link Options} will be ignored when using Edge Legacy.
|
|
36
|
-
*
|
|
37
33
|
* There are three primary classes exported by this module:
|
|
38
34
|
*
|
|
39
35
|
* 1. {@linkplain ServiceBuilder}: configures the
|
|
@@ -60,134 +56,115 @@
|
|
|
60
56
|
* You may also create a {@link Driver} with its own driver service. This is
|
|
61
57
|
* useful if you need to capture the server's log output for a specific session:
|
|
62
58
|
*
|
|
63
|
-
*
|
|
59
|
+
* const edge = require('selenium-webdriver/edge');
|
|
64
60
|
*
|
|
65
|
-
*
|
|
61
|
+
* const service = new edge.ServiceBuilder()
|
|
66
62
|
* .setPort(55555)
|
|
67
63
|
* .build();
|
|
68
64
|
*
|
|
69
|
-
*
|
|
65
|
+
* let options = new edge.Options();
|
|
70
66
|
* // configure browser options ...
|
|
71
67
|
*
|
|
72
|
-
*
|
|
68
|
+
* let driver = edge.Driver.createSession(options, service);
|
|
73
69
|
*
|
|
74
70
|
* Users should only instantiate the {@link Driver} class directly when they
|
|
75
71
|
* need a custom driver service configuration (as shown above). For normal
|
|
76
|
-
* operation, users should start
|
|
72
|
+
* operation, users should start msedgedriver using the
|
|
77
73
|
* {@link ./builder.Builder selenium-webdriver.Builder}.
|
|
78
74
|
*
|
|
79
|
-
* [WebDriver (EdgeHTML)]: https://docs.microsoft.com/en-us/microsoft-edge/webdriver
|
|
80
75
|
* [WebDriver (Chromium)]: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium
|
|
81
76
|
*/
|
|
82
77
|
|
|
83
78
|
'use strict'
|
|
84
79
|
|
|
85
|
-
const
|
|
80
|
+
const { Browser } = require('./lib/capabilities')
|
|
86
81
|
const io = require('./io')
|
|
87
|
-
const webdriver = require('./lib/webdriver')
|
|
88
|
-
const { Browser, Capabilities } = require('./lib/capabilities')
|
|
89
82
|
const chromium = require('./chromium')
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Name of the EdgeDriver executable.
|
|
86
|
+
* @type {string}
|
|
87
|
+
* @const
|
|
88
|
+
*/
|
|
93
89
|
const EDGEDRIVER_CHROMIUM_EXE =
|
|
94
90
|
process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver'
|
|
95
91
|
|
|
92
|
+
/** @type {remote.DriverService} */
|
|
93
|
+
let defaultService = null
|
|
94
|
+
|
|
96
95
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @param {string=} browserName Name of the Edge driver executable to locate.
|
|
101
|
-
* May be either 'msedge' to locate the Edge Chromium driver, or 'MicrosoftEdge' to
|
|
102
|
-
* locate the Edge Legacy driver. If omitted, will attempt to locate Edge Legacy.
|
|
103
|
-
* @return {?string} the located executable, or `null`.
|
|
96
|
+
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
|
97
|
+
* a [ChromeDriver](https://chromedriver.chromium.org/)
|
|
98
|
+
* server in a child process.
|
|
104
99
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
class ServiceBuilder extends chromium.ServiceBuilder {
|
|
101
|
+
/**
|
|
102
|
+
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
|
103
|
+
* the builder will attempt to locate the msedgedriver on the current
|
|
104
|
+
* PATH.
|
|
105
|
+
* @throws {Error} If provided executable does not exist, or the msedgedriver
|
|
106
|
+
* cannot be found on the PATH.
|
|
107
|
+
*/
|
|
108
|
+
constructor(opt_exe) {
|
|
109
|
+
let exe = opt_exe || locateSynchronously()
|
|
110
|
+
if (!exe) {
|
|
111
|
+
throw Error(
|
|
112
|
+
`The WebDriver for Edge could not be found on the current PATH. Please download the ` +
|
|
113
|
+
`latest version of ${EDGEDRIVER_CHROMIUM_EXE} from ` +
|
|
114
|
+
`https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ ` +
|
|
115
|
+
`and ensure it can be found on your PATH.`
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
super(exe)
|
|
119
|
+
this.setLoopback(true)
|
|
110
120
|
}
|
|
111
|
-
|
|
112
|
-
return process.platform === 'win32'
|
|
113
|
-
? io.findInPath(EDGEDRIVER_LEGACY_EXE, true)
|
|
114
|
-
: null
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
/**
|
|
118
|
-
* Class for managing
|
|
124
|
+
* Class for managing edge chromium specific options.
|
|
119
125
|
*/
|
|
120
126
|
class Options extends chromium.Options {
|
|
121
127
|
/**
|
|
122
|
-
*
|
|
123
|
-
* Otherwise, use Edge Legacy (EdgeHTML). Defaults to using Edge Legacy.
|
|
128
|
+
* Sets the path to the edge binary to use
|
|
124
129
|
*
|
|
125
|
-
*
|
|
130
|
+
* The binary path be absolute or relative to the msedgedriver server
|
|
131
|
+
* executable, but it must exist on the machine that will launch edge chromium.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} path The path to the edgedriver binary to use.
|
|
126
134
|
* @return {!Options} A self reference.
|
|
127
135
|
*/
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
return this
|
|
136
|
+
setEdgeChromiumBinaryPath(path) {
|
|
137
|
+
return this.setBinaryPath(path)
|
|
131
138
|
}
|
|
132
139
|
}
|
|
133
140
|
|
|
134
|
-
Options.USE_EDGE_CHROMIUM = 'ms:edgeChromium'
|
|
135
|
-
Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
|
|
136
|
-
Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
|
|
137
|
-
Options.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
|
|
138
|
-
|
|
139
141
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @return {boolean}
|
|
142
|
+
* Creates a new WebDriver client for Microsoft's Edge.
|
|
142
143
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
class Driver extends chromium.Driver {
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new browser session for Microsoft's Edge browser.
|
|
147
|
+
*
|
|
148
|
+
* @param {(Capabilities|Options)=} opt_config The configuration options.
|
|
149
|
+
* @param {remote.DriverService=} opt_serviceExecutor The service to use; will create
|
|
150
|
+
* a new Legacy or Chromium service based on {@linkplain Options} by default.
|
|
151
|
+
* @return {!Driver} A new driver instance.
|
|
152
|
+
*/
|
|
153
|
+
static createSession(opt_config, opt_serviceExecutor) {
|
|
154
|
+
let caps = opt_config || new Options()
|
|
155
|
+
return /** @type {!Driver} */ (
|
|
156
|
+
super.createSession(caps, opt_serviceExecutor)
|
|
157
|
+
)
|
|
150
158
|
}
|
|
151
159
|
|
|
152
|
-
return false
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Creates {@link remote.DriverService} instances that manage a
|
|
157
|
-
* WebDriver server in a child process. Used for driving both
|
|
158
|
-
* Microsoft Edge Legacy and Chromium. A ServiceBuilder constructed
|
|
159
|
-
* with default parameters will launch a MicrosoftWebDriver child
|
|
160
|
-
* process for driving Edge Legacy. You may pass in a path to
|
|
161
|
-
* msedgedriver.exe to use Edge Chromium instead.
|
|
162
|
-
*/
|
|
163
|
-
class ServiceBuilder extends chromium.ServiceBuilder {
|
|
164
160
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @throws {Error} If provided executable does not exist, or the
|
|
169
|
-
* MicrosoftWebDriver cannot be found on the PATH.
|
|
161
|
+
* This function is a no-op as file detectors are not supported by this
|
|
162
|
+
* implementation.
|
|
163
|
+
* @override
|
|
170
164
|
*/
|
|
171
|
-
|
|
172
|
-
const exe = opt_exe || locateSynchronously()
|
|
173
|
-
if (!exe) {
|
|
174
|
-
throw Error(
|
|
175
|
-
'The WebDriver for Edge could not be found on the current PATH. Please ' +
|
|
176
|
-
'download the latest version of ' +
|
|
177
|
-
EDGEDRIVER_LEGACY_EXE +
|
|
178
|
-
' from ' +
|
|
179
|
-
'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ and ' +
|
|
180
|
-
'ensure it can be found on your PATH.'
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
super(exe)
|
|
185
|
-
}
|
|
165
|
+
setFileDetector() {}
|
|
186
166
|
}
|
|
187
167
|
|
|
188
|
-
/** @type {remote.DriverService} */
|
|
189
|
-
var defaultService = null
|
|
190
|
-
|
|
191
168
|
/**
|
|
192
169
|
* Sets the default service to use for new Edge instances.
|
|
193
170
|
* @param {!remote.DriverService} service The service to use.
|
|
@@ -216,45 +193,21 @@ function getDefaultService() {
|
|
|
216
193
|
return defaultService
|
|
217
194
|
}
|
|
218
195
|
|
|
219
|
-
function createServiceFromCapabilities(options) {
|
|
220
|
-
let exe
|
|
221
|
-
if (useEdgeChromium(options)) {
|
|
222
|
-
exe = locateSynchronously(EDGE_CHROMIUM_BROWSER_NAME)
|
|
223
|
-
}
|
|
224
|
-
return new ServiceBuilder(exe).build()
|
|
225
|
-
}
|
|
226
|
-
|
|
227
196
|
/**
|
|
228
|
-
*
|
|
197
|
+
* _Synchronously_ attempts to locate the chromedriver executable on the current
|
|
198
|
+
* system.
|
|
199
|
+
*
|
|
200
|
+
* @return {?string} the located executable, or `null`.
|
|
229
201
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
* Creates a new browser session for Microsoft's Edge browser.
|
|
233
|
-
*
|
|
234
|
-
* @param {(Capabilities|Options)=} options The configuration options.
|
|
235
|
-
* @param {remote.DriverService=} opt_service The service to use; will create
|
|
236
|
-
* a new Legacy or Chromium service based on {@linkplain Options} by default.
|
|
237
|
-
* @return {!Driver} A new driver instance.
|
|
238
|
-
*/
|
|
239
|
-
static createSession(options, opt_service) {
|
|
240
|
-
options = options || new Options()
|
|
241
|
-
let service = opt_service || createServiceFromCapabilities(options)
|
|
242
|
-
let client = service.start().then((url) => new http.HttpClient(url))
|
|
243
|
-
let executor = new http.Executor(client)
|
|
244
|
-
|
|
245
|
-
return /** @type {!Driver} */ (super.createSession(executor, options, () =>
|
|
246
|
-
service.kill()
|
|
247
|
-
))
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* This function is a no-op as file detectors are not supported by this
|
|
252
|
-
* implementation.
|
|
253
|
-
* @override
|
|
254
|
-
*/
|
|
255
|
-
setFileDetector() {}
|
|
202
|
+
function locateSynchronously() {
|
|
203
|
+
return io.findInPath(EDGEDRIVER_CHROMIUM_EXE, true)
|
|
256
204
|
}
|
|
257
205
|
|
|
206
|
+
Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
|
|
207
|
+
Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
|
|
208
|
+
Driver.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
|
|
209
|
+
Driver.getDefaultService = getDefaultService
|
|
210
|
+
|
|
258
211
|
// PUBLIC API
|
|
259
212
|
|
|
260
213
|
exports.Driver = Driver
|
package/firefox.js
CHANGED
|
@@ -124,7 +124,6 @@ const io = require('./io')
|
|
|
124
124
|
const remote = require('./remote')
|
|
125
125
|
const webdriver = require('./lib/webdriver')
|
|
126
126
|
const zip = require('./io/zip')
|
|
127
|
-
const cdp = require('./devtools/CDPConnection')
|
|
128
127
|
const { Browser, Capabilities } = require('./lib/capabilities')
|
|
129
128
|
const { Zip } = require('./io/zip')
|
|
130
129
|
|
|
@@ -394,6 +393,24 @@ class Options extends Capabilities {
|
|
|
394
393
|
}
|
|
395
394
|
throw TypeError('binary must be a string path or Channel object')
|
|
396
395
|
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Enables Mobile start up features
|
|
399
|
+
*
|
|
400
|
+
* @param {string} androidPackage The package to use
|
|
401
|
+
* @return {!Options} A self reference
|
|
402
|
+
*/
|
|
403
|
+
enableMobile(androidPackage = "org.mozilla.firefox", androidActivity = null, deviceSerial = null) {
|
|
404
|
+
this.firefoxOptions_().androidPackage = androidPackage
|
|
405
|
+
|
|
406
|
+
if (androidActivity) {
|
|
407
|
+
this.firefoxOptions_().androidActivity = androidActivity
|
|
408
|
+
}
|
|
409
|
+
if (deviceSerial) {
|
|
410
|
+
this.firefoxOptions_().deviceSerial = deviceSerial
|
|
411
|
+
}
|
|
412
|
+
return this
|
|
413
|
+
}
|
|
397
414
|
}
|
|
398
415
|
|
|
399
416
|
/**
|
package/http/index.js
CHANGED
|
@@ -77,8 +77,9 @@ class HttpClient {
|
|
|
77
77
|
* Defaults to `http.globalAgent`.
|
|
78
78
|
* @param {?string=} opt_proxy The proxy to use for the connection to the
|
|
79
79
|
* server. Default is to use no proxy.
|
|
80
|
+
* @param {?Object.<string,Object>} client_options
|
|
80
81
|
*/
|
|
81
|
-
constructor(serverUrl, opt_agent, opt_proxy) {
|
|
82
|
+
constructor(serverUrl, opt_agent, opt_proxy, client_options = {}) {
|
|
82
83
|
/** @private {http.Agent} */
|
|
83
84
|
this.agent_ = opt_agent || null
|
|
84
85
|
|
|
@@ -88,12 +89,33 @@ class HttpClient {
|
|
|
88
89
|
*/
|
|
89
90
|
this.options_ = getRequestOptions(serverUrl)
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* client options, header overrides
|
|
94
|
+
*/
|
|
95
|
+
this.client_options = client_options
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* sets keep-alive for the agent
|
|
99
|
+
* see https://stackoverflow.com/a/58332910
|
|
100
|
+
*/
|
|
101
|
+
this.keepAlive = this.client_options['keep-alive']
|
|
102
|
+
|
|
91
103
|
/**
|
|
92
104
|
* @private {?RequestOptions}
|
|
93
105
|
*/
|
|
94
106
|
this.proxyOptions_ = opt_proxy ? getRequestOptions(opt_proxy) : null
|
|
95
107
|
}
|
|
96
108
|
|
|
109
|
+
get keepAlive() {
|
|
110
|
+
return this.agent_.keepAlive
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
set keepAlive(value) {
|
|
114
|
+
if (value === 'true' || value === true) {
|
|
115
|
+
this.agent_.keepAlive = true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
97
119
|
/** @override */
|
|
98
120
|
send(httpRequest) {
|
|
99
121
|
let data
|
|
@@ -106,7 +128,7 @@ class HttpClient {
|
|
|
106
128
|
})
|
|
107
129
|
}
|
|
108
130
|
|
|
109
|
-
headers['User-Agent'] = USER_AGENT
|
|
131
|
+
headers['User-Agent'] = this.client_options['user-agent'] || USER_AGENT
|
|
110
132
|
headers['Content-Length'] = 0
|
|
111
133
|
if (httpRequest.method == 'POST' || httpRequest.method == 'PUT') {
|
|
112
134
|
data = JSON.stringify(httpRequest.data)
|
|
@@ -232,7 +254,7 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) {
|
|
|
232
254
|
hash: location.hash,
|
|
233
255
|
headers: {
|
|
234
256
|
Accept: 'application/json; charset=utf-8',
|
|
235
|
-
'User-Agent': USER_AGENT,
|
|
257
|
+
'User-Agent': options.headers['User-Agent'] || USER_AGENT,
|
|
236
258
|
},
|
|
237
259
|
},
|
|
238
260
|
onOk,
|
package/ie.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
/**
|
|
19
19
|
* @fileoverview Defines a {@linkplain Driver WebDriver} client for Microsoft's
|
|
20
20
|
* Internet Explorer. Before using the IEDriver, you must download the latest
|
|
21
|
-
* [IEDriverServer](
|
|
21
|
+
* [IEDriverServer](https://www.selenium.dev/downloads/)
|
|
22
22
|
* and place it on your
|
|
23
23
|
* [PATH](http://en.wikipedia.org/wiki/PATH_%28variable%29). You must also apply
|
|
24
24
|
* the system configuration outlined on the Selenium project
|
|
@@ -370,7 +370,7 @@ class Options extends Capabilities {
|
|
|
370
370
|
behavior !== SCROLL_BEHAVIOUR.TOP &&
|
|
371
371
|
behavior !== SCROLL_BEHAVIOUR.BOTTOM
|
|
372
372
|
) {
|
|
373
|
-
throw new error.InvalidArgumentError(`Element Scroll Behavior out of range.
|
|
373
|
+
throw new error.InvalidArgumentError(`Element Scroll Behavior out of range.
|
|
374
374
|
It should be either ${SCROLL_BEHAVIOUR.TOP} or ${SCROLL_BEHAVIOUR.BOTTOM}`)
|
|
375
375
|
}
|
|
376
376
|
this.options_[Key.ELEMENT_SCROLL_BEHAVIOR] = behavior
|
|
@@ -402,9 +402,9 @@ function createServiceFromCapabilities(capabilities) {
|
|
|
402
402
|
if (!exe || !fs.existsSync(exe)) {
|
|
403
403
|
throw Error(
|
|
404
404
|
`${IEDRIVER_EXE} could not be found on the current PATH. Please ` +
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
`download the latest version of ${IEDRIVER_EXE} from ` +
|
|
406
|
+
'https://www.selenium.dev/downloads/ and ' +
|
|
407
|
+
'ensure it can be found on your system PATH.'
|
|
408
408
|
)
|
|
409
409
|
}
|
|
410
410
|
|
|
@@ -478,9 +478,9 @@ class Driver extends webdriver.WebDriver {
|
|
|
478
478
|
let client = service.start().then((url) => new http.HttpClient(url))
|
|
479
479
|
let executor = new http.Executor(client)
|
|
480
480
|
|
|
481
|
-
return /** @type {!Driver} */ (
|
|
482
|
-
service.kill()
|
|
483
|
-
)
|
|
481
|
+
return /** @type {!Driver} */ (
|
|
482
|
+
super.createSession(executor, options, () => service.kill())
|
|
483
|
+
)
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
/**
|