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

Method _run

py/selenium/webdriver/common/selenium_manager.py:129–157  ·  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

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

Callers 4

binary_pathsMethod · 0.95
test_run_successfulFunction · 0.80
test_run_exceptionFunction · 0.80

Calls 6

WebDriverExceptionClass · 0.90
joinMethod · 0.80
_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