selenium-webdriver 4.0.0-beta.1 → 4.0.0-beta.2
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 +12 -0
- package/devtools/CDPConnection.js +16 -18
- package/edge.js +89 -130
- 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/capabilities.js +0 -1
- package/lib/webdriver.js +19 -7
- package/package.json +1 -1
- package/testing/index.js +2 -7
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## v4.0.0-beta.2
|
|
2
|
+
|
|
3
|
+
* Removed support for Edge legacy.
|
|
4
|
+
* Make the build silent for WebDriver Bidi generated code
|
|
5
|
+
* resolve file path correctly (#9223)
|
|
6
|
+
* Update example in edge.js (#9231)
|
|
7
|
+
* Use a flat namespace for selenium options for finding WebDriver Bidi endpoint
|
|
8
|
+
* Removing duplicate license text updated by update_copyright.js
|
|
9
|
+
* Updating copyright text
|
|
10
|
+
* Minor code cleanup
|
|
11
|
+
* Removing duplicate variable declaration of IE from capabilities
|
|
12
|
+
|
|
1
13
|
## v4.0.0-beta.1
|
|
2
14
|
|
|
3
15
|
* JS Binding support for WebDriver Bidi in Firefox
|
|
@@ -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,121 @@
|
|
|
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')
|
|
83
|
+
const http = require('./http')
|
|
84
|
+
const webdriver = require('./lib/webdriver')
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Name of the EdgeDriver executable.
|
|
88
|
+
* @type {string}
|
|
89
|
+
* @const
|
|
90
|
+
*/
|
|
93
91
|
const EDGEDRIVER_CHROMIUM_EXE =
|
|
94
92
|
process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver'
|
|
95
93
|
|
|
94
|
+
/** @type {remote.DriverService} */
|
|
95
|
+
let defaultService = null
|
|
96
|
+
|
|
96
97
|
/**
|
|
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`.
|
|
98
|
+
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
|
99
|
+
* a [ChromeDriver](https://chromedriver.chromium.org/)
|
|
100
|
+
* server in a child process.
|
|
104
101
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
class ServiceBuilder extends chromium.ServiceBuilder {
|
|
103
|
+
/**
|
|
104
|
+
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
|
105
|
+
* the builder will attempt to locate the msedgedriver on the current
|
|
106
|
+
* PATH.
|
|
107
|
+
* @throws {Error} If provided executable does not exist, or the msedgedriver
|
|
108
|
+
* cannot be found on the PATH.
|
|
109
|
+
*/
|
|
110
|
+
constructor(opt_exe) {
|
|
111
|
+
let exe = opt_exe || locateSynchronously()
|
|
112
|
+
if (!exe) {
|
|
113
|
+
throw Error(
|
|
114
|
+
`The WebDriver for Edge could not be found on the current PATH. Please download the `+
|
|
115
|
+
`latest version of ${EDGEDRIVER_CHROMIUM_EXE} from `+
|
|
116
|
+
`https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ `+
|
|
117
|
+
`and ensure it can be found on your PATH.`
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
super(exe)
|
|
121
|
+
this.setLoopback(true)
|
|
110
122
|
}
|
|
111
|
-
|
|
112
|
-
return process.platform === 'win32'
|
|
113
|
-
? io.findInPath(EDGEDRIVER_LEGACY_EXE, true)
|
|
114
|
-
: null
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
/**
|
|
118
|
-
* Class for managing
|
|
126
|
+
* Class for managing edge chromium specific options.
|
|
119
127
|
*/
|
|
120
128
|
class Options extends chromium.Options {
|
|
121
129
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
130
|
+
* Sets the path to the edge binary to use
|
|
131
|
+
*
|
|
132
|
+
* The binary path be absolute or relative to the msedgedriver server
|
|
133
|
+
* executable, but it must exist on the machine that will launch edge chromium.
|
|
124
134
|
*
|
|
125
|
-
* @param {
|
|
135
|
+
* @param {string} path The path to the edgedriver binary to use.
|
|
126
136
|
* @return {!Options} A self reference.
|
|
127
137
|
*/
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
return this
|
|
138
|
+
setEdgeChromiumBinaryPath(path) {
|
|
139
|
+
return this.setBinaryPath(path)
|
|
131
140
|
}
|
|
132
141
|
}
|
|
133
142
|
|
|
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
143
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @return {boolean}
|
|
144
|
+
* Creates a new WebDriver client for Microsoft's Edge.
|
|
142
145
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
class Driver extends webdriver.WebDriver {
|
|
147
|
+
/**
|
|
148
|
+
* Creates a new browser session for Microsoft's Edge browser.
|
|
149
|
+
*
|
|
150
|
+
* @param {(Capabilities|Options)=} options The configuration options.
|
|
151
|
+
* @param {remote.DriverService=} opt_service The service to use; will create
|
|
152
|
+
* a new Legacy or Chromium service based on {@linkplain Options} by default.
|
|
153
|
+
* @return {!Driver} A new driver instance.
|
|
154
|
+
*/
|
|
155
|
+
static createSession(options, opt_service) {
|
|
156
|
+
options = options || new Options()
|
|
157
|
+
let service = opt_service || getDefaultService()
|
|
158
|
+
let client = service.start().then((url) => new http.HttpClient(url))
|
|
159
|
+
let executor = new http.Executor(client)
|
|
147
160
|
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
return /** @type {!Driver} */ (super.createSession(executor, options, () =>
|
|
162
|
+
service.kill()
|
|
163
|
+
))
|
|
150
164
|
}
|
|
151
165
|
|
|
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
166
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @throws {Error} If provided executable does not exist, or the
|
|
169
|
-
* MicrosoftWebDriver cannot be found on the PATH.
|
|
167
|
+
* This function is a no-op as file detectors are not supported by this
|
|
168
|
+
* implementation.
|
|
169
|
+
* @override
|
|
170
170
|
*/
|
|
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
|
-
}
|
|
171
|
+
setFileDetector() {}
|
|
186
172
|
}
|
|
187
173
|
|
|
188
|
-
/** @type {remote.DriverService} */
|
|
189
|
-
var defaultService = null
|
|
190
|
-
|
|
191
174
|
/**
|
|
192
175
|
* Sets the default service to use for new Edge instances.
|
|
193
176
|
* @param {!remote.DriverService} service The service to use.
|
|
@@ -197,7 +180,7 @@ function setDefaultService(service) {
|
|
|
197
180
|
if (defaultService && defaultService.isRunning()) {
|
|
198
181
|
throw Error(
|
|
199
182
|
'The previously configured EdgeDriver service is still running. ' +
|
|
200
|
-
|
|
183
|
+
'You must shut it down before you may adjust its configuration.'
|
|
201
184
|
)
|
|
202
185
|
}
|
|
203
186
|
defaultService = service
|
|
@@ -216,45 +199,21 @@ function getDefaultService() {
|
|
|
216
199
|
return defaultService
|
|
217
200
|
}
|
|
218
201
|
|
|
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
202
|
|
|
227
203
|
/**
|
|
228
|
-
*
|
|
204
|
+
* _Synchronously_ attempts to locate the chromedriver executable on the current
|
|
205
|
+
* system.
|
|
206
|
+
*
|
|
207
|
+
* @return {?string} the located executable, or `null`.
|
|
229
208
|
*/
|
|
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() {}
|
|
209
|
+
function locateSynchronously() {
|
|
210
|
+
return io.findInPath(EDGEDRIVER_CHROMIUM_EXE, true)
|
|
256
211
|
}
|
|
257
212
|
|
|
213
|
+
Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
|
|
214
|
+
Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
|
|
215
|
+
Driver.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
|
|
216
|
+
|
|
258
217
|
// PUBLIC API
|
|
259
218
|
|
|
260
219
|
exports.Driver = Driver
|