@@ -38,6 +38,7 @@ const path = require('path')
38
38
const { NoSuchElementError } = require('./error')
39
39
const cdpTargets = ['page', 'browser']
40
40
const Credential = require('./virtual_authenticator').Credential
41
+
const webElement = require('./webelement')
41
42
42
43
// Capability names that are defined in the W3C spec.
43
44
const W3C_CAPABILITY_NAMES = new Set([
@@ -618,17 +619,17 @@ class IWebDriver {
618
619
* Takes a PDF of the current page. The driver makes a best effort to
619
620
* return a PDF based on the provided parameters.
620
621
*
621
-
* @param {{orientation: (string|undefined),
622
-
* scale: (number|undefined),
623
-
* background: (boolean|undefined)
624
-
* width: (number|undefined)
625
-
* height: (number|undefined)
626
-
* top: (number|undefined)
627
-
* bottom: (number|undefined)
628
-
* left: (number|undefined)
629
-
* right: (number|undefined)
630
-
* shrinkToFit: (boolean|undefined)
631
-
* pageRanges: (<Array>|undefined)}} options.
622
+
* @param {{orientation:(string|undefined),
623
+
* scale:(number|undefined),
624
+
* background:(boolean|undefined),
625
+
* width:(number|undefined),
626
+
* height:(number|undefined),
627
+
* top:(number|undefined),
628
+
* bottom:(number|undefined),
629
+
* left:(number|undefined),
630
+
* right:(number|undefined),
631
+
* shrinkToFit:(boolean|undefined),
632
+
* pageRanges:(Array|undefined)}} options
632
633
*/
633
634
printPage(options) {} // eslint-disable-line
634
635
}
@@ -2382,7 +2383,7 @@ class TargetLocator {
2382
2383
2383
2384
const LEGACY_ELEMENT_ID_KEY = 'ELEMENT'
2384
2385
const ELEMENT_ID_KEY = 'element-6066-11e4-a52e-4f735466cecf'
2385
-
const SHADOWROOT_ID_KEY = 'shadow-6066-11e4-a52e-4f735466cecf'
2386
+
const SHADOW_ROOT_ID_KEY = 'shadow-6066-11e4-a52e-4f735466cecf'
2386
2387
2387
2388
/**
2388
2389
* Represents a DOM element. WebElements can be found by searching from the
@@ -2427,27 +2428,15 @@ class WebElement {
2427
2428
* @throws {TypeError} if the object is not a valid encoded ID.
2428
2429
*/
2429
2430
static extractId(obj) {
2430
-
if (obj && typeof obj === 'object') {
2431
-
if (typeof obj[ELEMENT_ID_KEY] === 'string') {
2432
-
return obj[ELEMENT_ID_KEY]
2433
-
} else if (typeof obj[LEGACY_ELEMENT_ID_KEY] === 'string') {
2434
-
return obj[LEGACY_ELEMENT_ID_KEY]
2435
-
}
2436
-
}
2437
-
throw new TypeError('object is not a WebElement ID')
2431
+
return webElement.extractId(obj)
2438
2432
}
2439
2433
2440
2434
/**
2441
2435
* @param {?} obj the object to test.
2442
2436
* @return {boolean} whether the object is a valid encoded WebElement ID.
2443
2437
*/
2444
2438
static isId(obj) {
2445
-
return (
2446
-
obj &&
2447
-
typeof obj === 'object' &&
2448
-
(typeof obj[ELEMENT_ID_KEY] === 'string' ||
2449
-
typeof obj[LEGACY_ELEMENT_ID_KEY] === 'string')
2450
-
)
2439
+
return webElement.isId(obj)
2451
2440
}
2452
2441
2453
2442
/**
@@ -2992,8 +2981,8 @@ class ShadowRoot {
2992
2981
*/
2993
2982
static extractId(obj) {
2994
2983
if (obj && typeof obj === 'object') {
2995
-
if (typeof obj[SHADOWROOT_ID_KEY] === 'string') {
2996
-
return obj[SHADOWROOT_ID_KEY]
2984
+
if (typeof obj[SHADOW_ROOT_ID_KEY] === 'string') {
2985
+
return obj[SHADOW_ROOT_ID_KEY]
2997
2986
}
2998
2987
}
2999
2988
throw new TypeError('object is not a ShadowRoot ID')
@@ -3007,7 +2996,7 @@ class ShadowRoot {
3007
2996
return (
3008
2997
obj &&
3009
2998
typeof obj === 'object' &&
3010
-
typeof obj[SHADOWROOT_ID_KEY] === 'string'
2999
+
typeof obj[SHADOW_ROOT_ID_KEY] === 'string'
3011
3000
)
3012
3001
}
3013
3002
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4