selenium-webdriver 4.1.0 → 4.1.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 +15 -0
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/chrome.js +13 -10
- package/chromium.js +32 -6
- package/edge.js +8 -6
- package/example/google_search.js +1 -1
- package/firefox.js +32 -17
- package/index.js +4 -4
- package/io/exec.js +2 -1
- package/io/index.js +23 -21
- package/io/zip.js +1 -3
- package/lib/by.js +5 -5
- package/lib/command.js +1 -11
- package/lib/error.js +1 -20
- package/lib/http.js +62 -158
- package/lib/input.js +1 -1
- 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 +95 -101
- package/net/index.js +14 -7
- package/net/portprober.js +4 -3
- package/opera.js +19 -22
- package/package.json +1 -1
- package/remote/index.js +12 -9
- package/safari.js +3 -3
- package/testing/index.js +11 -4
package/lib/webdriver.js
CHANGED
|
@@ -250,30 +250,30 @@ class IWebDriver {
|
|
|
250
250
|
* result.
|
|
251
251
|
* @template T
|
|
252
252
|
*/
|
|
253
|
-
execute(command) {
|
|
253
|
+
execute(command) {} // eslint-disable-line
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
256
|
* Sets the {@linkplain input.FileDetector file detector} that should be
|
|
257
257
|
* used with this instance.
|
|
258
258
|
* @param {input.FileDetector} detector The detector to use or `null`.
|
|
259
259
|
*/
|
|
260
|
-
setFileDetector(detector) {
|
|
260
|
+
setFileDetector(detector) {} // eslint-disable-line
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
263
|
* @return {!command.Executor} The command executor used by this instance.
|
|
264
264
|
*/
|
|
265
|
-
getExecutor() {
|
|
265
|
+
getExecutor() {}
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
268
|
* @return {!Promise<!Session>} A promise for this client's session.
|
|
269
269
|
*/
|
|
270
|
-
getSession() {
|
|
270
|
+
getSession() {}
|
|
271
271
|
|
|
272
272
|
/**
|
|
273
273
|
* @return {!Promise<!Capabilities>} A promise that will resolve with
|
|
274
274
|
* the this instance's capabilities.
|
|
275
275
|
*/
|
|
276
|
-
getCapabilities() {
|
|
276
|
+
getCapabilities() {}
|
|
277
277
|
|
|
278
278
|
/**
|
|
279
279
|
* Terminates the browser session. After calling quit, this instance will be
|
|
@@ -283,7 +283,7 @@ class IWebDriver {
|
|
|
283
283
|
* @return {!Promise<void>} A promise that will be resolved when the
|
|
284
284
|
* command has completed.
|
|
285
285
|
*/
|
|
286
|
-
quit() {
|
|
286
|
+
quit() {}
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* Creates a new action sequence using this driver. The sequence will not be
|
|
@@ -296,7 +296,7 @@ class IWebDriver {
|
|
|
296
296
|
* for details).
|
|
297
297
|
* @return {!input.Actions} A new action sequence for this instance.
|
|
298
298
|
*/
|
|
299
|
-
actions(options) {
|
|
299
|
+
actions(options) {} // eslint-disable-line
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
302
|
* Executes a snippet of JavaScript in the context of the currently selected
|
|
@@ -334,7 +334,7 @@ class IWebDriver {
|
|
|
334
334
|
* scripts return value.
|
|
335
335
|
* @template T
|
|
336
336
|
*/
|
|
337
|
-
executeScript(script, ...args) {
|
|
337
|
+
executeScript(script, ...args) {} // eslint-disable-line
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
340
|
* Executes a snippet of asynchronous JavaScript in the context of the
|
|
@@ -411,7 +411,7 @@ class IWebDriver {
|
|
|
411
411
|
* value.
|
|
412
412
|
* @template T
|
|
413
413
|
*/
|
|
414
|
-
executeAsyncScript(script, ...args) {
|
|
414
|
+
executeAsyncScript(script, ...args) {} // eslint-disable-line
|
|
415
415
|
|
|
416
416
|
/**
|
|
417
417
|
* Waits for a condition to evaluate to a "truthy" value. The condition may be
|
|
@@ -462,7 +462,7 @@ class IWebDriver {
|
|
|
462
462
|
timeout = undefined, // eslint-disable-line
|
|
463
463
|
message = undefined, // eslint-disable-line
|
|
464
464
|
pollTimeout = undefined // eslint-disable-line
|
|
465
|
-
) {
|
|
465
|
+
) {}
|
|
466
466
|
|
|
467
467
|
/**
|
|
468
468
|
* Makes the driver sleep for the given amount of time.
|
|
@@ -471,7 +471,7 @@ class IWebDriver {
|
|
|
471
471
|
* @return {!Promise<void>} A promise that will be resolved when the sleep has
|
|
472
472
|
* finished.
|
|
473
473
|
*/
|
|
474
|
-
sleep(ms) {
|
|
474
|
+
sleep(ms) {} // eslint-disable-line
|
|
475
475
|
|
|
476
476
|
/**
|
|
477
477
|
* Retrieves the current window handle.
|
|
@@ -479,7 +479,7 @@ class IWebDriver {
|
|
|
479
479
|
* @return {!Promise<string>} A promise that will be resolved with the current
|
|
480
480
|
* window handle.
|
|
481
481
|
*/
|
|
482
|
-
getWindowHandle() {
|
|
482
|
+
getWindowHandle() {}
|
|
483
483
|
|
|
484
484
|
/**
|
|
485
485
|
* Retrieves a list of all available window handles.
|
|
@@ -487,7 +487,7 @@ class IWebDriver {
|
|
|
487
487
|
* @return {!Promise<!Array<string>>} A promise that will be resolved with an
|
|
488
488
|
* array of window handles.
|
|
489
489
|
*/
|
|
490
|
-
getAllWindowHandles() {
|
|
490
|
+
getAllWindowHandles() {}
|
|
491
491
|
|
|
492
492
|
/**
|
|
493
493
|
* Retrieves the current page's source. The returned source is a representation
|
|
@@ -497,7 +497,7 @@ class IWebDriver {
|
|
|
497
497
|
* @return {!Promise<string>} A promise that will be resolved with the current
|
|
498
498
|
* page source.
|
|
499
499
|
*/
|
|
500
|
-
getPageSource() {
|
|
500
|
+
getPageSource() {}
|
|
501
501
|
|
|
502
502
|
/**
|
|
503
503
|
* Closes the current window.
|
|
@@ -505,7 +505,7 @@ class IWebDriver {
|
|
|
505
505
|
* @return {!Promise<void>} A promise that will be resolved when this command
|
|
506
506
|
* has completed.
|
|
507
507
|
*/
|
|
508
|
-
close() {
|
|
508
|
+
close() {}
|
|
509
509
|
|
|
510
510
|
/**
|
|
511
511
|
* Navigates to the given URL.
|
|
@@ -514,7 +514,7 @@ class IWebDriver {
|
|
|
514
514
|
* @return {!Promise<void>} A promise that will be resolved when the document
|
|
515
515
|
* has finished loading.
|
|
516
516
|
*/
|
|
517
|
-
get(url) {
|
|
517
|
+
get(url) {} // eslint-disable-line
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
520
|
* Retrieves the URL for the current page.
|
|
@@ -522,7 +522,7 @@ class IWebDriver {
|
|
|
522
522
|
* @return {!Promise<string>} A promise that will be resolved with the
|
|
523
523
|
* current URL.
|
|
524
524
|
*/
|
|
525
|
-
getCurrentUrl() {
|
|
525
|
+
getCurrentUrl() {}
|
|
526
526
|
|
|
527
527
|
/**
|
|
528
528
|
* Retrieves the current page title.
|
|
@@ -530,7 +530,7 @@ class IWebDriver {
|
|
|
530
530
|
* @return {!Promise<string>} A promise that will be resolved with the current
|
|
531
531
|
* page's title.
|
|
532
532
|
*/
|
|
533
|
-
getTitle() {
|
|
533
|
+
getTitle() {}
|
|
534
534
|
|
|
535
535
|
/**
|
|
536
536
|
* Locates an element on the page. If the element cannot be found, a
|
|
@@ -570,7 +570,7 @@ class IWebDriver {
|
|
|
570
570
|
* commands against the located element. If the element is not found, the
|
|
571
571
|
* element will be invalidated and all scheduled commands aborted.
|
|
572
572
|
*/
|
|
573
|
-
findElement(locator) {
|
|
573
|
+
findElement(locator) {} // eslint-disable-line
|
|
574
574
|
|
|
575
575
|
/**
|
|
576
576
|
* Search for multiple elements on the page. Refer to the documentation on
|
|
@@ -580,7 +580,7 @@ class IWebDriver {
|
|
|
580
580
|
* @return {!Promise<!Array<!WebElement>>} A promise that will resolve to an
|
|
581
581
|
* array of WebElements.
|
|
582
582
|
*/
|
|
583
|
-
findElements(locator) {
|
|
583
|
+
findElements(locator) {} // eslint-disable-line
|
|
584
584
|
|
|
585
585
|
/**
|
|
586
586
|
* Takes a screenshot of the current page. The driver makes a best effort to
|
|
@@ -594,23 +594,23 @@ class IWebDriver {
|
|
|
594
594
|
* @return {!Promise<string>} A promise that will be resolved to the
|
|
595
595
|
* screenshot as a base-64 encoded PNG.
|
|
596
596
|
*/
|
|
597
|
-
takeScreenshot() {
|
|
597
|
+
takeScreenshot() {}
|
|
598
598
|
|
|
599
599
|
/**
|
|
600
600
|
* @return {!Options} The options interface for this instance.
|
|
601
601
|
*/
|
|
602
|
-
manage() {
|
|
602
|
+
manage() {}
|
|
603
603
|
|
|
604
604
|
/**
|
|
605
605
|
* @return {!Navigation} The navigation interface for this instance.
|
|
606
606
|
*/
|
|
607
|
-
navigate() {
|
|
607
|
+
navigate() {}
|
|
608
608
|
|
|
609
609
|
/**
|
|
610
610
|
* @return {!TargetLocator} The target locator interface for this
|
|
611
611
|
* instance.
|
|
612
612
|
*/
|
|
613
|
-
switchTo() {
|
|
613
|
+
switchTo() {}
|
|
614
614
|
|
|
615
615
|
/**
|
|
616
616
|
*
|
|
@@ -629,7 +629,7 @@ class IWebDriver {
|
|
|
629
629
|
* shrinkToFit: (boolean|undefined)
|
|
630
630
|
* pageRanges: (<Array>|undefined)}} options.
|
|
631
631
|
*/
|
|
632
|
-
printPage(options) {
|
|
632
|
+
printPage(options) {} // eslint-disable-line
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
/**
|
|
@@ -669,7 +669,7 @@ class WebDriver {
|
|
|
669
669
|
// If session is a rejected promise, add a no-op rejection handler.
|
|
670
670
|
// This effectively hides setup errors until users attempt to interact
|
|
671
671
|
// with the session.
|
|
672
|
-
this.session_.catch(function () {
|
|
672
|
+
this.session_.catch(function () {})
|
|
673
673
|
|
|
674
674
|
/** @private {!command.Executor} */
|
|
675
675
|
this.executor_ = executor
|
|
@@ -765,12 +765,12 @@ class WebDriver {
|
|
|
765
765
|
this.session_ = Promise.reject(
|
|
766
766
|
new error.NoSuchSessionError(
|
|
767
767
|
'This driver instance does not have a valid session ID ' +
|
|
768
|
-
|
|
768
|
+
'(did you call WebDriver.quit()?) and may no longer be used.'
|
|
769
769
|
)
|
|
770
770
|
)
|
|
771
771
|
|
|
772
772
|
// Only want the session rejection to bubble if accessed.
|
|
773
|
-
this.session_.catch(function () {
|
|
773
|
+
this.session_.catch(function () {})
|
|
774
774
|
|
|
775
775
|
if (this.onQuit_) {
|
|
776
776
|
return this.onQuit_.call(void 0)
|
|
@@ -831,15 +831,18 @@ class WebDriver {
|
|
|
831
831
|
let timeoutMessage = resolveWaitMessage(message)
|
|
832
832
|
reject(
|
|
833
833
|
new error.TimeoutError(
|
|
834
|
-
`${timeoutMessage}Timed out waiting for promise to resolve after ${
|
|
834
|
+
`${timeoutMessage}Timed out waiting for promise to resolve after ${
|
|
835
|
+
Date.now() - start
|
|
835
836
|
}ms`
|
|
836
837
|
)
|
|
837
838
|
)
|
|
838
839
|
} catch (ex) {
|
|
839
840
|
reject(
|
|
840
841
|
new error.TimeoutError(
|
|
841
|
-
`${
|
|
842
|
-
|
|
842
|
+
`${
|
|
843
|
+
ex.message
|
|
844
|
+
}\nTimed out waiting for promise to resolve after ${
|
|
845
|
+
Date.now() - start
|
|
843
846
|
}ms`
|
|
844
847
|
)
|
|
845
848
|
)
|
|
@@ -869,7 +872,7 @@ class WebDriver {
|
|
|
869
872
|
if (typeof fn !== 'function') {
|
|
870
873
|
throw TypeError(
|
|
871
874
|
'Wait condition must be a promise-like object, function, or a ' +
|
|
872
|
-
|
|
875
|
+
'Condition object'
|
|
873
876
|
)
|
|
874
877
|
}
|
|
875
878
|
|
|
@@ -921,7 +924,7 @@ class WebDriver {
|
|
|
921
924
|
if (!(value instanceof WebElement)) {
|
|
922
925
|
throw TypeError(
|
|
923
926
|
'WebElementCondition did not resolve to a WebElement: ' +
|
|
924
|
-
|
|
927
|
+
Object.prototype.toString.call(value)
|
|
925
928
|
)
|
|
926
929
|
}
|
|
927
930
|
return value
|
|
@@ -1393,7 +1396,7 @@ class WebDriver {
|
|
|
1393
1396
|
|
|
1394
1397
|
callback(event)
|
|
1395
1398
|
}
|
|
1396
|
-
|
|
1399
|
+
|
|
1397
1400
|
if (params.method === 'Log.entryAdded') {
|
|
1398
1401
|
const logEventParams = params['params']
|
|
1399
1402
|
const logEntry = logEventParams['entry']
|
|
@@ -1405,7 +1408,6 @@ class WebDriver {
|
|
|
1405
1408
|
|
|
1406
1409
|
callback(event)
|
|
1407
1410
|
}
|
|
1408
|
-
|
|
1409
1411
|
})
|
|
1410
1412
|
await connection.execute('Runtime.enable', {}, null)
|
|
1411
1413
|
}
|
|
@@ -1783,7 +1785,7 @@ class Options {
|
|
|
1783
1785
|
} else if (typeof value !== 'undefined') {
|
|
1784
1786
|
throw TypeError(
|
|
1785
1787
|
'invalid timeouts configuration:' +
|
|
1786
|
-
|
|
1788
|
+
` expected "${key}" to be a number, got ${typeof value}`
|
|
1787
1789
|
)
|
|
1788
1790
|
}
|
|
1789
1791
|
}
|
|
@@ -1844,7 +1846,7 @@ function legacyTimeout(driver, type, ms) {
|
|
|
1844
1846
|
*
|
|
1845
1847
|
* @record
|
|
1846
1848
|
*/
|
|
1847
|
-
Options.Cookie = function () {
|
|
1849
|
+
Options.Cookie = function () {}
|
|
1848
1850
|
|
|
1849
1851
|
/**
|
|
1850
1852
|
* The name of the cookie.
|
|
@@ -1949,21 +1951,6 @@ class Window {
|
|
|
1949
1951
|
new command.Command(command.Name.GET_WINDOW_RECT)
|
|
1950
1952
|
)
|
|
1951
1953
|
} catch (ex) {
|
|
1952
|
-
if (ex instanceof error.UnknownCommandError) {
|
|
1953
|
-
let { width, height } = await this.driver_.execute(
|
|
1954
|
-
new command.Command(command.Name.GET_WINDOW_SIZE).setParameter(
|
|
1955
|
-
'windowHandle',
|
|
1956
|
-
'current'
|
|
1957
|
-
)
|
|
1958
|
-
)
|
|
1959
|
-
let { x, y } = await this.driver_.execute(
|
|
1960
|
-
new command.Command(command.Name.GET_WINDOW_POSITION).setParameter(
|
|
1961
|
-
'windowHandle',
|
|
1962
|
-
'current'
|
|
1963
|
-
)
|
|
1964
|
-
)
|
|
1965
|
-
return { x, y, width, height }
|
|
1966
|
-
}
|
|
1967
1954
|
throw ex
|
|
1968
1955
|
}
|
|
1969
1956
|
}
|
|
@@ -1993,26 +1980,6 @@ class Window {
|
|
|
1993
1980
|
})
|
|
1994
1981
|
)
|
|
1995
1982
|
} catch (ex) {
|
|
1996
|
-
if (ex instanceof error.UnknownCommandError) {
|
|
1997
|
-
if (typeof x === 'number' && typeof y === 'number') {
|
|
1998
|
-
await this.driver_.execute(
|
|
1999
|
-
new command.Command(command.Name.SET_WINDOW_POSITION)
|
|
2000
|
-
.setParameter('windowHandle', 'current')
|
|
2001
|
-
.setParameter('x', x)
|
|
2002
|
-
.setParameter('y', y)
|
|
2003
|
-
)
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
if (typeof width === 'number' && typeof height === 'number') {
|
|
2007
|
-
await this.driver_.execute(
|
|
2008
|
-
new command.Command(command.Name.SET_WINDOW_SIZE)
|
|
2009
|
-
.setParameter('windowHandle', 'current')
|
|
2010
|
-
.setParameter('width', width)
|
|
2011
|
-
.setParameter('height', height)
|
|
2012
|
-
)
|
|
2013
|
-
}
|
|
2014
|
-
return this.getRect()
|
|
2015
|
-
}
|
|
2016
1983
|
throw ex
|
|
2017
1984
|
}
|
|
2018
1985
|
}
|
|
@@ -2550,18 +2517,18 @@ class WebElement {
|
|
|
2550
2517
|
*/
|
|
2551
2518
|
async sendKeys(...args) {
|
|
2552
2519
|
let keys = []
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2520
|
+
;(await Promise.all(args)).forEach((key) => {
|
|
2521
|
+
let type = typeof key
|
|
2522
|
+
if (type === 'number') {
|
|
2523
|
+
key = String(key)
|
|
2524
|
+
} else if (type !== 'string') {
|
|
2525
|
+
throw TypeError('each key must be a number of string; got ' + type)
|
|
2526
|
+
}
|
|
2560
2527
|
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2528
|
+
// The W3C protocol requires keys to be specified as an array where
|
|
2529
|
+
// each element is a single key.
|
|
2530
|
+
keys.push(...key.split(''))
|
|
2531
|
+
})
|
|
2565
2532
|
|
|
2566
2533
|
if (!this.driver_.fileDetector_) {
|
|
2567
2534
|
return this.execute_(
|
|
@@ -2571,10 +2538,15 @@ class WebElement {
|
|
|
2571
2538
|
)
|
|
2572
2539
|
}
|
|
2573
2540
|
|
|
2574
|
-
|
|
2575
|
-
this.driver_
|
|
2576
|
-
|
|
2577
|
-
|
|
2541
|
+
try {
|
|
2542
|
+
keys = await this.driver_.fileDetector_.handleFile(
|
|
2543
|
+
this.driver_,
|
|
2544
|
+
keys.join('')
|
|
2545
|
+
)
|
|
2546
|
+
} catch (ex) {
|
|
2547
|
+
console.log('Error trying parse string as a file with file detector; sending keys instead' + ex)
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2578
2550
|
return this.execute_(
|
|
2579
2551
|
new command.Command(command.Name.SEND_KEYS_TO_ELEMENT)
|
|
2580
2552
|
.setParameter('text', keys)
|
|
@@ -2651,6 +2623,36 @@ class WebElement {
|
|
|
2651
2623
|
)
|
|
2652
2624
|
}
|
|
2653
2625
|
|
|
2626
|
+
/**
|
|
2627
|
+
* Get the value of the given attribute of the element.
|
|
2628
|
+
* <p>
|
|
2629
|
+
* This method, unlike {@link #getAttribute(String)}, returns the value of the attribute with the
|
|
2630
|
+
* given name but not the property with the same name.
|
|
2631
|
+
* <p>
|
|
2632
|
+
* The following are deemed to be "boolean" attributes, and will return either "true" or null:
|
|
2633
|
+
* <p>
|
|
2634
|
+
* async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
|
|
2635
|
+
* defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate,
|
|
2636
|
+
* iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade,
|
|
2637
|
+
* novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless,
|
|
2638
|
+
* seeking, selected, truespeed, willvalidate
|
|
2639
|
+
* <p>
|
|
2640
|
+
* See <a href="https://w3c.github.io/webdriver/#get-element-attribute">W3C WebDriver specification</a>
|
|
2641
|
+
* for more details.
|
|
2642
|
+
*
|
|
2643
|
+
* @param attributeName The name of the attribute.
|
|
2644
|
+
* @return The attribute's value or null if the value is not set.
|
|
2645
|
+
*/
|
|
2646
|
+
|
|
2647
|
+
getDomAttribute(attributeName) {
|
|
2648
|
+
return this.execute_(
|
|
2649
|
+
new command.Command(command.Name.GET_DOM_ATTRIBUTE).setParameter(
|
|
2650
|
+
'name',
|
|
2651
|
+
attributeName
|
|
2652
|
+
)
|
|
2653
|
+
)
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2654
2656
|
/**
|
|
2655
2657
|
* Get the given property of the referenced web element
|
|
2656
2658
|
* @param {string} propertyName The name of the attribute to query.
|
|
@@ -2719,15 +2721,7 @@ class WebElement {
|
|
|
2719
2721
|
new command.Command(command.Name.GET_ELEMENT_RECT)
|
|
2720
2722
|
)
|
|
2721
2723
|
} catch (err) {
|
|
2722
|
-
|
|
2723
|
-
const { width, height } = await this.execute_(
|
|
2724
|
-
new command.Command(command.Name.GET_ELEMENT_SIZE)
|
|
2725
|
-
)
|
|
2726
|
-
const { x, y } = await this.execute_(
|
|
2727
|
-
new command.Command(command.Name.GET_ELEMENT_LOCATION)
|
|
2728
|
-
)
|
|
2729
|
-
return { x, y, width, height }
|
|
2730
|
-
}
|
|
2724
|
+
throw err;
|
|
2731
2725
|
}
|
|
2732
2726
|
}
|
|
2733
2727
|
|
|
@@ -2764,8 +2758,8 @@ class WebElement {
|
|
|
2764
2758
|
const form = this.findElement({ xpath: './ancestor-or-self::form' })
|
|
2765
2759
|
this.driver_.executeScript(
|
|
2766
2760
|
"var e = arguments[0].ownerDocument.createEvent('Event');" +
|
|
2767
|
-
|
|
2768
|
-
|
|
2761
|
+
"e.initEvent('submit', true, true);" +
|
|
2762
|
+
'if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }',
|
|
2769
2763
|
form
|
|
2770
2764
|
)
|
|
2771
2765
|
}
|
|
@@ -2861,7 +2855,6 @@ class WebElementPromise extends WebElement {
|
|
|
2861
2855
|
* retrieve elements that live in the DOM below the ShadowRoot.
|
|
2862
2856
|
*/
|
|
2863
2857
|
class ShadowRoot {
|
|
2864
|
-
|
|
2865
2858
|
constructor(driver, id) {
|
|
2866
2859
|
this.driver_ = driver
|
|
2867
2860
|
this.id_ = id
|
|
@@ -2891,7 +2884,8 @@ class ShadowRoot {
|
|
|
2891
2884
|
return (
|
|
2892
2885
|
obj &&
|
|
2893
2886
|
typeof obj === 'object' &&
|
|
2894
|
-
typeof obj[SHADOWROOT_ID_KEY] === 'string'
|
|
2887
|
+
typeof obj[SHADOWROOT_ID_KEY] === 'string'
|
|
2888
|
+
)
|
|
2895
2889
|
}
|
|
2896
2890
|
|
|
2897
2891
|
/**
|
|
@@ -3005,7 +2999,7 @@ class ShadowRootPromise extends ShadowRoot {
|
|
|
3005
2999
|
/**
|
|
3006
3000
|
* @param {!WebDriver} driver The parent WebDriver instance for this
|
|
3007
3001
|
* element.
|
|
3008
|
-
* @param {!Promise<!ShadowRoot>}
|
|
3002
|
+
* @param {!Promise<!ShadowRoot>} shadow A promise
|
|
3009
3003
|
* that will resolve to the promised element.
|
|
3010
3004
|
*/
|
|
3011
3005
|
constructor(driver, shadow) {
|
package/net/index.js
CHANGED
|
@@ -35,10 +35,10 @@ function getLoInterface() {
|
|
|
35
35
|
* @param {string} family The IP family (IPv4 or IPv6). Defaults to IPv4.
|
|
36
36
|
* @return {(string|undefined)} The located IP address or undefined.
|
|
37
37
|
*/
|
|
38
|
-
function
|
|
38
|
+
function getIPAddress(loopback, family) {
|
|
39
39
|
let interfaces
|
|
40
40
|
if (loopback) {
|
|
41
|
-
|
|
41
|
+
const lo = getLoInterface()
|
|
42
42
|
interfaces = lo ? [lo] : null
|
|
43
43
|
}
|
|
44
44
|
interfaces = interfaces || os.networkInterfaces()
|
|
@@ -63,8 +63,8 @@ function getAddress(loopback, family) {
|
|
|
63
63
|
* @param {string=} family The IP family to retrieve. Defaults to "IPv4".
|
|
64
64
|
* @return {(string|undefined)} The IP address or undefined if not available.
|
|
65
65
|
*/
|
|
66
|
-
|
|
67
|
-
return
|
|
66
|
+
function getAddress(family = 'IPv4') {
|
|
67
|
+
return getIPAddress(false, family)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
@@ -72,8 +72,8 @@ exports.getAddress = function (family = 'IPv4') {
|
|
|
72
72
|
* @param {string=} family The IP family to retrieve. Defaults to "IPv4".
|
|
73
73
|
* @return {(string|undefined)} The IP address or undefined if not available.
|
|
74
74
|
*/
|
|
75
|
-
|
|
76
|
-
return
|
|
75
|
+
function getLoopbackAddress(family = 'IPv4') {
|
|
76
|
+
return getIPAddress(true, family)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -84,7 +84,7 @@ exports.getLoopbackAddress = function (family = 'IPv4') {
|
|
|
84
84
|
* @return {{host: string, port: ?number}} A host and port. If no port is
|
|
85
85
|
* present in the argument `hostport`, port is null.
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
function splitHostAndPort(hostport) {
|
|
88
88
|
let lastIndex = hostport.lastIndexOf(':')
|
|
89
89
|
if (lastIndex < 0) {
|
|
90
90
|
return { host: hostport, port: null }
|
|
@@ -105,3 +105,10 @@ exports.splitHostAndPort = function (hostport) {
|
|
|
105
105
|
let port = parseInt(hostport.slice(lastIndex + 1), 10)
|
|
106
106
|
return { host, port }
|
|
107
107
|
}
|
|
108
|
+
|
|
109
|
+
// PUBLIC API
|
|
110
|
+
module.exports = {
|
|
111
|
+
splitHostAndPort,
|
|
112
|
+
getLoopbackAddress,
|
|
113
|
+
getAddress,
|
|
114
|
+
}
|
package/net/portprober.js
CHANGED
package/opera.js
CHANGED
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
|
|
73
73
|
'use strict'
|
|
74
74
|
|
|
75
|
-
const http = require('./http')
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const http = require('./http')
|
|
76
|
+
const io = require('./io')
|
|
77
|
+
const capabilities = require('./lib/capabilities')
|
|
78
|
+
const Symbols = require('./lib/symbols')
|
|
79
|
+
const webdriver = require('./lib/webdriver')
|
|
80
|
+
const remote = require('./remote')
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* Name of the OperaDriver executable.
|
|
@@ -153,7 +153,7 @@ class ServiceBuilder extends remote.DriverService.Builder {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
/** @type {remote.DriverService} */
|
|
156
|
-
|
|
156
|
+
let defaultService = null
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Sets the default service to use for new OperaDriver instances.
|
|
@@ -187,7 +187,7 @@ function getDefaultService() {
|
|
|
187
187
|
* @type {string}
|
|
188
188
|
* @const
|
|
189
189
|
*/
|
|
190
|
-
|
|
190
|
+
const OPTIONS_CAPABILITY_KEY = 'chromeOptions'
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
193
|
* Class for managing {@linkplain Driver OperaDriver} specific options.
|
|
@@ -217,8 +217,8 @@ class Options {
|
|
|
217
217
|
* @return {!Options} The OperaDriver options.
|
|
218
218
|
*/
|
|
219
219
|
static fromCapabilities(caps) {
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
let options
|
|
221
|
+
const o = caps.get(OPTIONS_CAPABILITY_KEY)
|
|
222
222
|
if (o instanceof Options) {
|
|
223
223
|
options = o
|
|
224
224
|
} else if (o) {
|
|
@@ -249,8 +249,8 @@ class Options {
|
|
|
249
249
|
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
|
250
250
|
* @return {!Options} A self reference.
|
|
251
251
|
*/
|
|
252
|
-
addArguments(var_args) {
|
|
253
|
-
this.args_ = this.args_.concat.apply(this.args_,
|
|
252
|
+
addArguments(...var_args) {
|
|
253
|
+
this.args_ = this.args_.concat.apply(this.args_, var_args)
|
|
254
254
|
return this
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -262,11 +262,8 @@ class Options {
|
|
|
262
262
|
* extensions to add.
|
|
263
263
|
* @return {!Options} A self reference.
|
|
264
264
|
*/
|
|
265
|
-
addExtensions(var_args) {
|
|
266
|
-
this.extensions_ = this.extensions_.concat.apply(
|
|
267
|
-
this.extensions_,
|
|
268
|
-
arguments
|
|
269
|
-
)
|
|
265
|
+
addExtensions(...var_args) {
|
|
266
|
+
this.extensions_ = this.extensions_.concat.apply(this.extensions_, var_args)
|
|
270
267
|
return this
|
|
271
268
|
}
|
|
272
269
|
|
|
@@ -358,11 +355,11 @@ class Driver extends webdriver.WebDriver {
|
|
|
358
355
|
* @return {!Driver} A new driver instance.
|
|
359
356
|
*/
|
|
360
357
|
static createSession(opt_config, opt_service) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
358
|
+
const service = opt_service || getDefaultService()
|
|
359
|
+
const client = service.start().then((url) => new http.HttpClient(url))
|
|
360
|
+
const executor = new http.Executor(client)
|
|
364
361
|
|
|
365
|
-
|
|
362
|
+
let caps =
|
|
366
363
|
opt_config instanceof Options
|
|
367
364
|
? opt_config.toCapabilities()
|
|
368
365
|
: opt_config || capabilities.Capabilities.opera()
|
|
@@ -370,7 +367,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
370
367
|
// On Linux, the OperaDriver does not look for Opera on the PATH, so we
|
|
371
368
|
// must explicitly find it. See: operachromiumdriver #9.
|
|
372
369
|
if (process.platform === 'linux') {
|
|
373
|
-
|
|
370
|
+
const options = Options.fromCapabilities(caps)
|
|
374
371
|
if (!options.binary_) {
|
|
375
372
|
let exe = io.findInPath('opera', true)
|
|
376
373
|
if (!exe) {
|