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)
| 508 | return value |
| 509 | |
| 510 | def execute_cdp_cmd(self, cmd: str, cmd_args: dict): |
| 511 | """Execute Chrome Devtools Protocol command and get returned result. |
| 512 | |
| 513 | The command and command args should follow chrome devtools protocol domains/commands: |
| 514 | - https://chromedevtools.github.io/devtools-protocol/ |
| 515 | |
| 516 | Args: |
| 517 | cmd: Command name. |
| 518 | cmd_args: Command args. Empty dict {} if there is no command args. |
| 519 | |
| 520 | Returns: |
| 521 | A dict, empty dict {} if there is no result to return. To |
| 522 | getResponseBody: {'base64Encoded': False, 'body': 'response body |
| 523 | string'} |
| 524 | |
| 525 | Example: |
| 526 | `driver.execute_cdp_cmd("Network.getResponseBody", {"requestId": requestId})` |
| 527 | """ |
| 528 | if self.caps["browserName"].lower() == "firefox": |
| 529 | raise RuntimeError("CDP support for Firefox has been removed. Please switch to WebDriver BiDi.") |
| 530 | return self.execute("executeCdpCommand", {"cmd": cmd, "params": cmd_args})["value"] |
| 531 | |
| 532 | def execute( |
| 533 | self, |