@override
(command)
| 442 | |
| 443 | /** @override */ |
| 444 | async execute(command) { |
| 445 | let request = buildRequest(this.customCommands_, command) |
| 446 | this.log_.finer(() => `>>> ${request.method} ${request.path}`) |
| 447 | |
| 448 | let client = CLIENTS.get(this) |
| 449 | if (promise.isPromise(client)) { |
| 450 | client = await client |
| 451 | CLIENTS.set(this, client) |
| 452 | } |
| 453 | |
| 454 | let response = await client.send(request) |
| 455 | this.log_.finer(() => `>>>\n${request}\n<<<\n${response}`) |
| 456 | |
| 457 | let httpResponse = /** @type {!Response} */ (response) |
| 458 | |
| 459 | let { isW3C, value } = parseHttpResponse(command, httpResponse) |
| 460 | |
| 461 | if (command.getName() === cmd.Name.NEW_SESSION) { |
| 462 | if (!value || !value.sessionId) { |
| 463 | throw new error.WebDriverError(`Unable to parse new session response: ${response.body}`) |
| 464 | } |
| 465 | |
| 466 | // The remote end is a W3C compliant server if there is no `status` |
| 467 | // field in the response. |
| 468 | if (command.getName() === cmd.Name.NEW_SESSION) { |
| 469 | this.w3c = this.w3c || isW3C |
| 470 | } |
| 471 | |
| 472 | // No implementations use the `capabilities` key yet... |
| 473 | let capabilities = value.capabilities || value.value |
| 474 | return new Session(/** @type {{sessionId: string}} */ (value).sessionId, capabilities) |
| 475 | } |
| 476 | |
| 477 | return typeof value === 'undefined' ? null : value |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | /** |
no test coverage detected