MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / fromWireValue

Function fromWireValue

javascript/selenium-webdriver/lib/webdriver.js:211–230  ·  view source on GitHub ↗

* Converts a value from its JSON representation according to the WebDriver wire * protocol. Any JSON object that defines a WebElement ID will be decoded to a * WebElement object. All other values will be passed through as is. * * @param {!WebDriver} driver The driver to use as the parent

(driver, value)

Source from the content-addressed store, hash-verified

209 * @return {*} The converted value.
210 */
211function fromWireValue(driver, value) {
212 if (Array.isArray(value)) {
213 value = value.map((v) => fromWireValue(driver, v))
214 } else if (WebElement.isId(value)) {
215 let id = WebElement.extractId(value)
216 value = new WebElement(driver, id)
217 } else if (ShadowRoot.isId(value)) {
218 let id = ShadowRoot.extractId(value)
219 value = new ShadowRoot(driver, id)
220 } else if (isObject(value)) {
221 let result = {}
222 for (let key in value) {
223 if (Object.prototype.hasOwnProperty.call(value, key)) {
224 result[key] = fromWireValue(driver, value[key])
225 }
226 }
227 value = result
228 }
229 return value
230}
231
232/**
233 * Resolves a wait message from either a function or a string.

Callers 1

executeMethod · 0.85

Calls 5

isObjectFunction · 0.70
callMethod · 0.65
mapMethod · 0.45
isIdMethod · 0.45
extractIdMethod · 0.45

Tested by

no test coverage detected