MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / _run

Method _run

py/selenium/webdriver/common/selenium_manager.py:134–162  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

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]):

Callers 4

binary_pathsMethod · 0.95
test_run_successfulFunction · 0.80
test_run_exceptionFunction · 0.80

Calls 5

WebDriverExceptionClass · 0.90
_process_logsMethod · 0.80
runMethod · 0.65
decodeMethod · 0.65
debugMethod · 0.45

Tested by 3

test_run_successfulFunction · 0.64
test_run_exceptionFunction · 0.64