MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / extractId

Function extractId

javascript/selenium-webdriver/lib/webelement.js:46–55  ·  view source on GitHub ↗

* Extracts the encoded WebElement ID from the object. * * @param {?} obj The object to extract the ID from. * @return {string} the extracted ID. * @throws {TypeError} if the object is not a valid encoded ID.

(obj)

Source from the content-addressed store, hash-verified

44 * @throws {TypeError} if the object is not a valid encoded ID.
45 */
46function extractId(obj) {
47 if (isObject(obj)) {
48 if (typeof obj[ELEMENT_ID_KEY] === 'string') {
49 return obj[ELEMENT_ID_KEY]
50 } else if (typeof obj[LEGACY_ELEMENT_ID_KEY] === 'string') {
51 return obj[LEGACY_ELEMENT_ID_KEY]
52 }
53 }
54 throw new TypeError('object is not a WebElement ID')
55}
56
57// PUBLIC API
58

Callers

nothing calls this directly

Calls 1

isObjectFunction · 0.70

Tested by

no test coverage detected