Executes the Selenium Manager Binary. Args: args: the components of the command being executed. Returns: The log string containing the driver location.
(args: list[str])
| 132 | |
| 133 | @staticmethod |
| 134 | def _run(args: list[str]) -> dict: |
| 135 | """Executes the Selenium Manager Binary. |
| 136 | |
| 137 | Args: |
| 138 | args: the components of the command being executed. |
| 139 | |
| 140 | Returns: |
| 141 | The log string containing the driver location. |
| 142 | """ |
| 143 | command = " ".join(args) |
| 144 | logger.debug("Executing process: %s", command) |
| 145 | try: |
| 146 | if sys.platform == "win32": |
| 147 | completed_proc = subprocess.run(args, capture_output=True, creationflags=subprocess.CREATE_NO_WINDOW) |
| 148 | else: |
| 149 | completed_proc = subprocess.run(args, capture_output=True) |
| 150 | stdout = completed_proc.stdout.decode("utf-8").rstrip("\n") |
| 151 | stderr = completed_proc.stderr.decode("utf-8").rstrip("\n") |
| 152 | output = json.loads(stdout) if stdout != "" else {"logs": [], "result": {}} |
| 153 | except Exception as err: |
| 154 | raise WebDriverException(f"Unsuccessful command executed: {command}") from err |
| 155 | |
| 156 | SeleniumManager._process_logs(output["logs"]) |
| 157 | result = output["result"] |
| 158 | if completed_proc.returncode: |
| 159 | raise WebDriverException( |
| 160 | f"Unsuccessful command executed: {command}; code: {completed_proc.returncode}\n{result}\n{stderr}" |
| 161 | ) |
| 162 | return result |
| 163 | |
| 164 | @staticmethod |
| 165 | def _process_logs(log_items: list[dict]): |