selenium-webdriver 4.1.2 → 4.3.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 +207 -206
- package/chrome.js +10 -36
- package/chromium.js +4 -2
- package/devtools/CDPConnection.js +1 -1
- package/edge.js +8 -32
- package/firefox.js +1 -1
- package/ie.js +3 -3
- package/index.js +1 -47
- package/lib/capabilities.js +0 -8
- package/lib/command.js +9 -0
- package/lib/http.js +40 -0
- package/lib/input.js +76 -23
- package/lib/virtual_authenticator.js +230 -0
- package/lib/webdriver.js +137 -14
- package/net/index.js +9 -2
- package/package.json +10 -10
- package/testing/index.js +11 -15
- package/opera.js +0 -403
package/chrome.js
CHANGED
|
@@ -140,7 +140,6 @@ const CHROMEDRIVER_EXE =
|
|
|
140
140
|
process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver'
|
|
141
141
|
|
|
142
142
|
/** @type {remote.DriverService} */
|
|
143
|
-
let defaultService = null
|
|
144
143
|
|
|
145
144
|
/**
|
|
146
145
|
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
|
@@ -240,6 +239,14 @@ class Driver extends chromium.Driver {
|
|
|
240
239
|
super.createSession(caps, opt_serviceExecutor)
|
|
241
240
|
)
|
|
242
241
|
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* returns new instance chrome driver service
|
|
245
|
+
* @returns {remote.DriverService}
|
|
246
|
+
*/
|
|
247
|
+
static getDefaultService() {
|
|
248
|
+
return new ServiceBuilder().build()
|
|
249
|
+
}
|
|
243
250
|
}
|
|
244
251
|
|
|
245
252
|
/**
|
|
@@ -252,47 +259,14 @@ function locateSynchronously() {
|
|
|
252
259
|
return io.findInPath(CHROMEDRIVER_EXE, true)
|
|
253
260
|
}
|
|
254
261
|
|
|
255
|
-
/**
|
|
256
|
-
* Sets the default service to use for new ChromeDriver instances.
|
|
257
|
-
* @param {!remote.DriverService} service The service to use.
|
|
258
|
-
* @throws {Error} If the default service is currently running.
|
|
259
|
-
*/
|
|
260
|
-
function setDefaultService(service) {
|
|
261
|
-
if (defaultService && defaultService.isRunning()) {
|
|
262
|
-
throw Error(
|
|
263
|
-
`The previously configured ChromeDriver service is still running. ` +
|
|
264
|
-
`You must shut it down before you may adjust its configuration.`
|
|
265
|
-
)
|
|
266
|
-
}
|
|
267
|
-
defaultService = service
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Returns the default ChromeDriver service. If such a service has not been
|
|
272
|
-
* configured, one will be constructed using the default configuration for
|
|
273
|
-
* a ChromeDriver executable found on the system PATH.
|
|
274
|
-
* @return {!remote.DriverService} The default ChromeDriver service.
|
|
275
|
-
*/
|
|
276
|
-
function getDefaultService() {
|
|
277
|
-
if (!defaultService) {
|
|
278
|
-
defaultService = new ServiceBuilder().build()
|
|
279
|
-
}
|
|
280
|
-
return defaultService
|
|
281
|
-
}
|
|
282
|
-
|
|
283
262
|
Options.prototype.CAPABILITY_KEY = 'goog:chromeOptions'
|
|
284
263
|
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME
|
|
285
|
-
Driver.getDefaultService = getDefaultService
|
|
286
264
|
Driver.prototype.VENDOR_COMMAND_PREFIX = 'goog'
|
|
287
265
|
|
|
288
266
|
// PUBLIC API
|
|
289
|
-
|
|
290
267
|
module.exports = {
|
|
291
268
|
Driver: Driver,
|
|
292
269
|
Options,
|
|
293
|
-
ServiceBuilder
|
|
294
|
-
|
|
295
|
-
setDefaultService,
|
|
296
|
-
locateSynchronously
|
|
270
|
+
ServiceBuilder,
|
|
271
|
+
locateSynchronously,
|
|
297
272
|
}
|
|
298
|
-
|
package/chromium.js
CHANGED
|
@@ -661,11 +661,13 @@ class Driver extends webdriver.WebDriver {
|
|
|
661
661
|
*/
|
|
662
662
|
static createSession(caps, opt_serviceExecutor) {
|
|
663
663
|
let executor
|
|
664
|
+
let onQuit
|
|
664
665
|
if (opt_serviceExecutor instanceof http.Executor) {
|
|
665
666
|
executor = opt_serviceExecutor
|
|
666
667
|
configureExecutor(executor, this.VENDOR_COMMAND_PREFIX)
|
|
667
668
|
} else {
|
|
668
669
|
let service = opt_serviceExecutor || this.getDefaultService()
|
|
670
|
+
onQuit = () => service.kill()
|
|
669
671
|
executor = createExecutor(service.start(), this.VENDOR_COMMAND_PREFIX)
|
|
670
672
|
}
|
|
671
673
|
|
|
@@ -679,7 +681,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
679
681
|
}
|
|
680
682
|
}
|
|
681
683
|
|
|
682
|
-
return /** @type {!Driver} */ (super.createSession(executor, caps))
|
|
684
|
+
return /** @type {!Driver} */ (super.createSession(executor, caps, onQuit))
|
|
683
685
|
}
|
|
684
686
|
|
|
685
687
|
/**
|
|
@@ -860,7 +862,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
860
862
|
* @return {!promise.Thenable<void>} A promise that will be resolved
|
|
861
863
|
* when the mirror command has been issued to the device.
|
|
862
864
|
*/
|
|
863
|
-
|
|
865
|
+
startDesktopMirroring(deviceName) {
|
|
864
866
|
return this.schedule(
|
|
865
867
|
new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter(
|
|
866
868
|
'sinkName',
|
package/edge.js
CHANGED
|
@@ -90,7 +90,6 @@ const EDGEDRIVER_CHROMIUM_EXE =
|
|
|
90
90
|
process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver'
|
|
91
91
|
|
|
92
92
|
/** @type {remote.DriverService} */
|
|
93
|
-
let defaultService = null
|
|
94
93
|
|
|
95
94
|
/**
|
|
96
95
|
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
|
@@ -157,6 +156,14 @@ class Driver extends chromium.Driver {
|
|
|
157
156
|
)
|
|
158
157
|
}
|
|
159
158
|
|
|
159
|
+
/**
|
|
160
|
+
* returns new instance of edge driver service
|
|
161
|
+
* @returns {remote.DriverService}
|
|
162
|
+
*/
|
|
163
|
+
static getDefaultService() {
|
|
164
|
+
return new ServiceBuilder().build()
|
|
165
|
+
}
|
|
166
|
+
|
|
160
167
|
/**
|
|
161
168
|
* This function is a no-op as file detectors are not supported by this
|
|
162
169
|
* implementation.
|
|
@@ -165,34 +172,6 @@ class Driver extends chromium.Driver {
|
|
|
165
172
|
setFileDetector() {}
|
|
166
173
|
}
|
|
167
174
|
|
|
168
|
-
/**
|
|
169
|
-
* Sets the default service to use for new Edge instances.
|
|
170
|
-
* @param {!remote.DriverService} service The service to use.
|
|
171
|
-
* @throws {Error} If the default service is currently running.
|
|
172
|
-
*/
|
|
173
|
-
function setDefaultService(service) {
|
|
174
|
-
if (defaultService && defaultService.isRunning()) {
|
|
175
|
-
throw Error(
|
|
176
|
-
'The previously configured EdgeDriver service is still running. ' +
|
|
177
|
-
'You must shut it down before you may adjust its configuration.'
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
defaultService = service
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Returns the default Microsoft Edge driver service. If such a service has
|
|
185
|
-
* not been configured, one will be constructed using the default configuration
|
|
186
|
-
* for a MicrosoftWebDriver executable found on the system PATH.
|
|
187
|
-
* @return {!remote.DriverService} The default Microsoft Edge driver service.
|
|
188
|
-
*/
|
|
189
|
-
function getDefaultService() {
|
|
190
|
-
if (!defaultService) {
|
|
191
|
-
defaultService = new ServiceBuilder().build()
|
|
192
|
-
}
|
|
193
|
-
return defaultService
|
|
194
|
-
}
|
|
195
|
-
|
|
196
175
|
/**
|
|
197
176
|
* _Synchronously_ attempts to locate the chromedriver executable on the current
|
|
198
177
|
* system.
|
|
@@ -206,7 +185,6 @@ function locateSynchronously() {
|
|
|
206
185
|
Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
|
|
207
186
|
Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
|
|
208
187
|
Driver.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
|
|
209
|
-
Driver.getDefaultService = getDefaultService
|
|
210
188
|
|
|
211
189
|
// PUBLIC API
|
|
212
190
|
|
|
@@ -214,7 +192,5 @@ module.exports = {
|
|
|
214
192
|
Driver,
|
|
215
193
|
Options,
|
|
216
194
|
ServiceBuilder,
|
|
217
|
-
getDefaultService,
|
|
218
|
-
setDefaultService,
|
|
219
195
|
locateSynchronously,
|
|
220
196
|
}
|
package/firefox.js
CHANGED
package/ie.js
CHANGED
|
@@ -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
|
|
package/index.js
CHANGED
|
@@ -38,7 +38,6 @@ 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
|
|
@@ -78,7 +77,7 @@ function startSeleniumServer(jar) {
|
|
|
78
77
|
function ensureFileDetectorsAreEnabled(ctor) {
|
|
79
78
|
return class extends ctor {
|
|
80
79
|
/** @param {input.FileDetector} detector */
|
|
81
|
-
setFileDetector
|
|
80
|
+
setFileDetector(detector) {
|
|
82
81
|
webdriver.WebDriver.prototype.setFileDetector.call(this, detector)
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -232,12 +231,6 @@ class Builder {
|
|
|
232
231
|
|
|
233
232
|
/** @private {http.Agent} */
|
|
234
233
|
this.agent_ = null
|
|
235
|
-
|
|
236
|
-
/** @private {opera.Options} */
|
|
237
|
-
this.operaOptions_ = null
|
|
238
|
-
|
|
239
|
-
/** @private {remote.DriverService.Builder} */
|
|
240
|
-
this.operaService_ = null
|
|
241
234
|
}
|
|
242
235
|
|
|
243
236
|
/**
|
|
@@ -432,20 +425,6 @@ class Builder {
|
|
|
432
425
|
return this
|
|
433
426
|
}
|
|
434
427
|
|
|
435
|
-
/**
|
|
436
|
-
* Sets Opera specific {@linkplain opera.Options options} for drivers
|
|
437
|
-
* created by this builder. Any logging or proxy settings defined on the given
|
|
438
|
-
* options will take precedence over those set through
|
|
439
|
-
* {@link #setLoggingPrefs} and {@link #setProxy}, respectively.
|
|
440
|
-
*
|
|
441
|
-
* @param {!opera.Options} options The OperaDriver options to use.
|
|
442
|
-
* @return {!Builder} A self reference.
|
|
443
|
-
*/
|
|
444
|
-
setOperaOptions(options) {
|
|
445
|
-
this.operaOptions_ = options
|
|
446
|
-
return this
|
|
447
|
-
}
|
|
448
|
-
|
|
449
428
|
/**
|
|
450
429
|
* @return {chrome.Options} the Chrome specific options currently configured
|
|
451
430
|
* for this builder.
|
|
@@ -560,21 +539,6 @@ class Builder {
|
|
|
560
539
|
return this
|
|
561
540
|
}
|
|
562
541
|
|
|
563
|
-
/**
|
|
564
|
-
* Sets the {@link opera.ServiceBuilder} to use to manage the
|
|
565
|
-
* operaDriver child process when creating sessions locally.
|
|
566
|
-
*
|
|
567
|
-
* @param {opera.ServiceBuilder} service the service to use.
|
|
568
|
-
* @return {!Builder} a self reference.
|
|
569
|
-
*/
|
|
570
|
-
setOperaService(service) {
|
|
571
|
-
if (service && !(service instanceof opera.ServiceBuilder)) {
|
|
572
|
-
throw TypeError('not a opera.ServiceBuilder object')
|
|
573
|
-
}
|
|
574
|
-
this.operaService_ = service
|
|
575
|
-
return this
|
|
576
|
-
}
|
|
577
|
-
|
|
578
542
|
/**
|
|
579
543
|
* Sets Safari specific {@linkplain safari.Options options} for drivers
|
|
580
544
|
* created by this builder. Any logging settings defined on the given options
|
|
@@ -648,8 +612,6 @@ class Builder {
|
|
|
648
612
|
capabilities.merge(this.safariOptions_)
|
|
649
613
|
} else if (browser === Browser.EDGE && this.edgeOptions_) {
|
|
650
614
|
capabilities.merge(this.edgeOptions_)
|
|
651
|
-
} else if (browser === Browser.OPERA && this.operaOptions_) {
|
|
652
|
-
capabilities.merge(this.operaOptions_)
|
|
653
615
|
}
|
|
654
616
|
|
|
655
617
|
checkOptions(
|
|
@@ -736,14 +698,6 @@ class Builder {
|
|
|
736
698
|
return createDriver(edge.Driver, capabilities, service)
|
|
737
699
|
}
|
|
738
700
|
|
|
739
|
-
case Browser.OPERA: {
|
|
740
|
-
let service = null
|
|
741
|
-
if (this.operaService_) {
|
|
742
|
-
service = this.operaService_.build()
|
|
743
|
-
}
|
|
744
|
-
return createDriver(opera.Driver, capabilities, service)
|
|
745
|
-
}
|
|
746
|
-
|
|
747
701
|
case Browser.SAFARI:
|
|
748
702
|
return createDriver(safari.Driver, capabilities)
|
|
749
703
|
|
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
|
@@ -164,6 +164,15 @@ const Name = {
|
|
|
164
164
|
FIND_ELEMENT_FROM_SHADOWROOT: 'findElementFromShadowRoot',
|
|
165
165
|
FIND_ELEMENTS_FROM_SHADOWROOT: 'findElementsFromShadowRoot',
|
|
166
166
|
|
|
167
|
+
// Virtual Authenticator Commands
|
|
168
|
+
ADD_VIRTUAL_AUTHENTICATOR: 'addVirtualAuthenticator',
|
|
169
|
+
REMOVE_VIRTUAL_AUTHENTICATOR: 'removeVirtualAuthenticator',
|
|
170
|
+
ADD_CREDENTIAL: 'addCredential',
|
|
171
|
+
GET_CREDENTIALS: 'getCredentials',
|
|
172
|
+
REMOVE_CREDENTIAL: 'removeCredential',
|
|
173
|
+
REMOVE_ALL_CREDENTIALS: 'removeAllCredentials',
|
|
174
|
+
SET_USER_VERIFIED: 'setUserVerified',
|
|
175
|
+
|
|
167
176
|
GET_AVAILABLE_LOG_TYPES: 'getAvailableLogTypes',
|
|
168
177
|
GET_LOG: 'getLog',
|
|
169
178
|
|
package/lib/http.js
CHANGED
|
@@ -347,6 +347,44 @@ const W3C_COMMAND_MAP = new Map([
|
|
|
347
347
|
|
|
348
348
|
// Server Extensions
|
|
349
349
|
[cmd.Name.UPLOAD_FILE, post('/session/:sessionId/se/file')],
|
|
350
|
+
|
|
351
|
+
// Virtual Authenticator
|
|
352
|
+
[
|
|
353
|
+
cmd.Name.ADD_VIRTUAL_AUTHENTICATOR,
|
|
354
|
+
post('/session/:sessionId/webauthn/authenticator'),
|
|
355
|
+
],
|
|
356
|
+
[
|
|
357
|
+
cmd.Name.REMOVE_VIRTUAL_AUTHENTICATOR,
|
|
358
|
+
del('/session/:sessionId/webauthn/authenticator/:authenticatorId'),
|
|
359
|
+
],
|
|
360
|
+
[
|
|
361
|
+
cmd.Name.ADD_CREDENTIAL,
|
|
362
|
+
post(
|
|
363
|
+
'/session/:sessionId/webauthn/authenticator/:authenticatorId/credential'
|
|
364
|
+
),
|
|
365
|
+
],
|
|
366
|
+
[
|
|
367
|
+
cmd.Name.GET_CREDENTIALS,
|
|
368
|
+
get(
|
|
369
|
+
'/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials'
|
|
370
|
+
),
|
|
371
|
+
],
|
|
372
|
+
[
|
|
373
|
+
cmd.Name.REMOVE_CREDENTIAL,
|
|
374
|
+
del(
|
|
375
|
+
'/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials/:credentialId'
|
|
376
|
+
),
|
|
377
|
+
],
|
|
378
|
+
[
|
|
379
|
+
cmd.Name.REMOVE_ALL_CREDENTIALS,
|
|
380
|
+
del(
|
|
381
|
+
'/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials'
|
|
382
|
+
),
|
|
383
|
+
],
|
|
384
|
+
[
|
|
385
|
+
cmd.Name.SET_USER_VERIFIED,
|
|
386
|
+
post('/session/:sessionId/webauthn/authenticator/:authenticatorId/uv'),
|
|
387
|
+
],
|
|
350
388
|
])
|
|
351
389
|
|
|
352
390
|
/**
|
|
@@ -472,6 +510,7 @@ class Executor {
|
|
|
472
510
|
this.log_.finer(() => `>>>\n${request}\n<<<\n${response}`)
|
|
473
511
|
|
|
474
512
|
let httpResponse = /** @type {!Response} */ (response)
|
|
513
|
+
|
|
475
514
|
let { isW3C, value } = parseHttpResponse(command, httpResponse)
|
|
476
515
|
|
|
477
516
|
if (command.getName() === cmd.Name.NEW_SESSION) {
|
|
@@ -530,6 +569,7 @@ function parseHttpResponse(command, httpResponse) {
|
|
|
530
569
|
}
|
|
531
570
|
|
|
532
571
|
let parsed = tryParse(httpResponse.body)
|
|
572
|
+
|
|
533
573
|
if (parsed && typeof parsed === 'object') {
|
|
534
574
|
let value = parsed.value
|
|
535
575
|
let isW3C =
|
package/lib/input.js
CHANGED
|
@@ -346,16 +346,42 @@ class Pointer extends Device {
|
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
348
|
* @param {!Button=} button The button to press.
|
|
349
|
+
* @param width
|
|
350
|
+
* @param height
|
|
351
|
+
* @param pressure
|
|
352
|
+
* @param tangentialPressure
|
|
353
|
+
* @param tiltX
|
|
354
|
+
* @param tiltY
|
|
355
|
+
* @param twist
|
|
356
|
+
* @param altitudeAngle
|
|
357
|
+
* @param azimuthAngle
|
|
349
358
|
* @return {!Action} An action to press the specified button with this device.
|
|
350
359
|
* @package
|
|
351
360
|
*/
|
|
352
|
-
press(
|
|
353
|
-
|
|
354
|
-
|
|
361
|
+
press(
|
|
362
|
+
button = Button.LEFT,
|
|
363
|
+
width = 0,
|
|
364
|
+
height = 0,
|
|
365
|
+
pressure = 0,
|
|
366
|
+
tangentialPressure = 0,
|
|
367
|
+
tiltX = 0,
|
|
368
|
+
tiltY = 0,
|
|
369
|
+
twist = 0,
|
|
370
|
+
altitudeAngle = 0,
|
|
371
|
+
azimuthAngle = 0
|
|
372
|
+
) {
|
|
355
373
|
return {
|
|
356
|
-
type: Action.Type.POINTER_DOWN,
|
|
357
|
-
|
|
358
|
-
|
|
374
|
+
type: Action.Type.POINTER_DOWN,
|
|
375
|
+
button,
|
|
376
|
+
width,
|
|
377
|
+
height,
|
|
378
|
+
pressure,
|
|
379
|
+
tangentialPressure,
|
|
380
|
+
tiltX,
|
|
381
|
+
tiltY,
|
|
382
|
+
twist,
|
|
383
|
+
altitudeAngle,
|
|
384
|
+
azimuthAngle,
|
|
359
385
|
}
|
|
360
386
|
}
|
|
361
387
|
|
|
@@ -385,15 +411,36 @@ class Pointer extends Device {
|
|
|
385
411
|
* @return {!Action} The new action.
|
|
386
412
|
* @package
|
|
387
413
|
*/
|
|
388
|
-
move({
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
414
|
+
move({
|
|
415
|
+
x = 0,
|
|
416
|
+
y = 0,
|
|
417
|
+
duration = 100,
|
|
418
|
+
origin = Origin.VIEWPORT,
|
|
419
|
+
width = 0,
|
|
420
|
+
height = 0,
|
|
421
|
+
pressure = 0,
|
|
422
|
+
tangentialPressure = 0,
|
|
423
|
+
tiltX = 0,
|
|
424
|
+
tiltY = 0,
|
|
425
|
+
twist = 0,
|
|
426
|
+
altitudeAngle = 0,
|
|
427
|
+
azimuthAngle = 0,
|
|
392
428
|
}) {
|
|
393
429
|
return {
|
|
394
|
-
type: Action.Type.POINTER_MOVE,
|
|
395
|
-
|
|
396
|
-
|
|
430
|
+
type: Action.Type.POINTER_MOVE,
|
|
431
|
+
origin,
|
|
432
|
+
duration,
|
|
433
|
+
x,
|
|
434
|
+
y,
|
|
435
|
+
width,
|
|
436
|
+
height,
|
|
437
|
+
pressure,
|
|
438
|
+
tangentialPressure,
|
|
439
|
+
tiltX,
|
|
440
|
+
tiltY,
|
|
441
|
+
twist,
|
|
442
|
+
altitudeAngle,
|
|
443
|
+
azimuthAngle,
|
|
397
444
|
}
|
|
398
445
|
}
|
|
399
446
|
}
|
|
@@ -410,10 +457,9 @@ Pointer.Type = {
|
|
|
410
457
|
|
|
411
458
|
class Wheel extends Device {
|
|
412
459
|
/**
|
|
413
|
-
* @param {string} id the device ID
|
|
414
|
-
* @param {Pointer.Type} type the pointer type.
|
|
460
|
+
* @param {string} id the device ID..
|
|
415
461
|
*/
|
|
416
|
-
constructor(id
|
|
462
|
+
constructor(id) {
|
|
417
463
|
super(Device.Type.WHEEL, id)
|
|
418
464
|
}
|
|
419
465
|
|
|
@@ -423,15 +469,19 @@ class Wheel extends Device {
|
|
|
423
469
|
* @param {number} y starting y coordinate
|
|
424
470
|
* @param {number} deltaX Delta X to scroll to target
|
|
425
471
|
* @param {number} deltaY Delta Y to scroll to target
|
|
472
|
+
* @param {WebElement} origin element origin
|
|
426
473
|
* @param {number} duration duration ratio be the ratio of time delta and duration
|
|
427
474
|
* @returns {!Action} An action to scroll with this device.
|
|
428
475
|
*/
|
|
429
476
|
scroll(x, y, deltaX, deltaY, origin, duration) {
|
|
430
477
|
return {
|
|
431
478
|
type: Action.Type.SCROLL,
|
|
432
|
-
duration: duration,
|
|
433
|
-
|
|
434
|
-
|
|
479
|
+
duration: duration,
|
|
480
|
+
x: x,
|
|
481
|
+
y: y,
|
|
482
|
+
deltaX: deltaX,
|
|
483
|
+
deltaY: deltaY,
|
|
484
|
+
origin: origin,
|
|
435
485
|
}
|
|
436
486
|
}
|
|
437
487
|
}
|
|
@@ -795,18 +845,21 @@ class Actions {
|
|
|
795
845
|
* @param {number} deltax delta x to scroll to target
|
|
796
846
|
* @param {number} deltay delta y to scroll to target
|
|
797
847
|
* @param {number} duration duration ratio be the ratio of time delta and duration
|
|
798
|
-
* @returns {!
|
|
848
|
+
* @returns {!Actions} An action to scroll with this device.
|
|
799
849
|
*/
|
|
800
850
|
scroll(x, y, targetDeltaX, targetDeltaY, origin, duration) {
|
|
801
|
-
return this.insert(
|
|
851
|
+
return this.insert(
|
|
852
|
+
this.wheel_,
|
|
853
|
+
this.wheel_.scroll(x, y, targetDeltaX, targetDeltaY, origin, duration)
|
|
854
|
+
)
|
|
802
855
|
}
|
|
803
856
|
|
|
804
857
|
/**
|
|
805
858
|
* Inserts an action for moving the mouse `x` and `y` pixels relative to the
|
|
806
859
|
* specified `origin`. The `origin` may be defined as the mouse's
|
|
807
|
-
* {@linkplain ./input.Origin.POINTER current position}, the
|
|
860
|
+
* {@linkplain ./input.Origin.POINTER current position}, the top-left corner of the
|
|
808
861
|
* {@linkplain ./input.Origin.VIEWPORT viewport}, or the center of a specific
|
|
809
|
-
* {@linkplain ./webdriver.WebElement WebElement}.
|
|
862
|
+
* {@linkplain ./webdriver.WebElement WebElement}. Default is top left corner of the view-port if origin is not specified
|
|
810
863
|
*
|
|
811
864
|
* You may adjust how long the remote end should take, in milliseconds, to
|
|
812
865
|
* perform the move using the `duration` parameter (defaults to 100 ms).
|