Execute Chrome Devtools Protocol command and get returned result. The command and command args should follow chrome devtools protocol domains/commands: - https://chromedevtools.github.io/devtools-protocol/ Args: cmd: Command name. cmd_args: Command
(self, cmd: str, cmd_args: dict)
| 442 | return value |
| 443 | |
| 444 | def execute_cdp_cmd(self, cmd: str, cmd_args: dict): |
| 445 | """Execute Chrome Devtools Protocol command and get returned result. |
| 446 | |
| 447 | The command and command args should follow chrome devtools protocol domains/commands: |
| 448 | - https://chromedevtools.github.io/devtools-protocol/ |
| 449 | |
| 450 | Args: |
| 451 | cmd: Command name. |
| 452 | cmd_args: Command args. Empty dict {} if there is no command args. |
| 453 | |
| 454 | Returns: |
| 455 | A dict, empty dict {} if there is no result to return. To |
| 456 | getResponseBody: {'base64Encoded': False, 'body': 'response body |
| 457 | string'} |
| 458 | |
| 459 | Example: |
| 460 | `driver.execute_cdp_cmd("Network.getResponseBody", {"requestId": requestId})` |
| 461 | """ |
| 462 | if self.caps["browserName"].lower() == "firefox": |
| 463 | raise RuntimeError("CDP support for Firefox has been removed. Please switch to WebDriver BiDi.") |
| 464 | return self.execute("executeCdpCommand", {"cmd": cmd, "params": cmd_args})["value"] |
| 465 | |
| 466 | def execute( |
| 467 | self, |