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

Function buildRequest

javascript/selenium-webdriver/lib/http.js:363–390  ·  view source on GitHub ↗

* @param {Map } customCommands * A map of custom command definitions. * @param {!cmd.Command} command The command to resolve. * @return {!Request} A promise that will resolve with the * command to execute.

(customCommands, command)

Source from the content-addressed store, hash-verified

361 * command to execute.
362 */
363function buildRequest(customCommands, command) {
364 log_.finest(() => `Translating command: ${command.getName()}`)
365 let spec = customCommands && customCommands.get(command.getName())
366 if (spec) {
367 return toHttpRequest(spec)
368 }
369
370 spec = W3C_COMMAND_MAP.get(command.getName())
371 if (typeof spec === 'function') {
372 log_.finest(() => `Transforming command for W3C: ${command.getName()}`)
373 let newCommand = spec(command)
374 return buildRequest(customCommands, newCommand)
375 } else if (spec) {
376 return toHttpRequest(spec)
377 }
378 throw new error.UnknownCommandError('Unrecognized command: ' + command.getName())
379
380 /**
381 * @param {CommandSpec} resource
382 * @return {!Request}
383 */
384 function toHttpRequest(resource) {
385 log_.finest(() => `Building HTTP request: ${JSON.stringify(resource)}`)
386 let parameters = command.getParameters()
387 let path = buildPath(resource.path, parameters)
388 return new Request(resource.method, path, parameters)
389 }
390}
391
392const CLIENTS = /** !WeakMap<!Executor, !(Client|IThenable<!Client>)> */ new WeakMap()
393

Callers 1

executeMethod · 0.85

Calls 4

toHttpRequestFunction · 0.85
finestMethod · 0.80
getNameMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected