SeleniumHQ/selenium · error · WebDriverException
Unsuccessful command executed: {command}; code: {completed_p
Error message
Unsuccessful command executed: {command}; code: {completed_proc.returncode}\n{result}\n{stderr} What it means
Raised by SeleniumManager._run() after the process completed but returned a non-zero exit code. The message includes the command, the numeric code, the parsed 'result' dict, and stderr — all of which come from the selenium-manager binary itself. This is the primary error surface for driver auto-management failures: the manager ran successfully as a process but could not fulfill the request.
Source
Thrown at py/selenium/webdriver/common/selenium_manager.py:154
The log string containing the driver location.
"""
command = " ".join(args)
logger.debug("Executing process: %s", command)
try:
if sys.platform == "win32":
completed_proc = subprocess.run(args, capture_output=True, creationflags=subprocess.CREATE_NO_WINDOW)
else:
completed_proc = subprocess.run(args, capture_output=True)
stdout = completed_proc.stdout.decode("utf-8").rstrip("\n")
stderr = completed_proc.stderr.decode("utf-8").rstrip("\n")
output = json.loads(stdout) if stdout != "" else {"logs": [], "result": {}}
except Exception as err:
raise WebDriverException(f"Unsuccessful command executed: {command}") from err
SeleniumManager._process_logs(output["logs"])
result = output["result"]
if completed_proc.returncode:
raise WebDriverException(
f"Unsuccessful command executed: {command}; code: {completed_proc.returncode}\n{result}\n{stderr}"
)
return result
@staticmethod
def _process_logs(log_items: list[dict]):
for item in log_items:
if item["level"] == "WARN":
logger.warning(item["message"])
elif item["level"] in ["DEBUG", "INFO"]:
logger.debug(item["message"])
View on GitHub (pinned to aa36b38e69)
Solutions
- Read the 'result' and stderr portions of the message — they name the specific failure (browser not found, driver download error, etc.).
- If a driver download is blocked, pre-place the driver and pass executable_path to the Service, or set the relevant env var (e.g. SE_CHROMEDRIVER, SE_GECKODRIVER).
- Ensure the target browser is actually installed and discoverable; on Linux check that the browser is on PATH or in a standard location.
- Set SE_MANAGER_PATH to a known-good manager or clear the Selenium Manager cache (~/.cache/selenium/) if it is corrupt.
Example fix
# before — no browser, manager fails to download driver
# ...code: 2 ... {browser not found} ...
# after — pin a local driver via Service
from selenium.webdriver.chrome.service import Service
service = Service(executable_path='/opt/chromedriver/chromedriver')
driver = webdriver.Chrome(service=service) Defensive patterns
Strategy: fallback
Validate before calling
null
Type guard
null
Try / catch
from selenium.common.exceptions import WebDriverException
try:
driver = webdriver.Chrome()
except WebDriverException as e:
if 'Unsuccessful command executed' in str(e) and 'code:' in str(e):
# fall back to a pre-placed driver
from selenium.webdriver.chrome.service import Service
driver = webdriver.Chrome(service=Service(executable_path='/opt/chromedriver')) Prevention
- Pre-stage driver binaries in CI images so a manager download failure is non-fatal.
- Read the embedded 'result'/'stderr' text to classify the failure before retrying.
- Allowlist driver-download hosts in corporate proxies.
When it happens
Trigger: Selenium Manager could not find a browser installed on the system, could not download the matching driver (network/proxy/firewall block), detected a version mismatch between browser and driver, or the cache directory is unwritable. The embedded 'result' and stderr fields describe the exact reason.
Common situations: Headless CI with no browser installed, corporate egress proxy blocking github.com/googlechromelabs downloads, a browser auto-updated past the cached driver, a broken or pinned incompatible driver version, and read-only HOME/cache directories.
Related errors
- Unable to obtain browser driver. For more informatio
- Error executing command for ${smBinary} with ${args}: ${erro
- Unsuccessful command executed: {command}
- Service {self._path} unexpectedly exited. Status code was: {
- {} {} not available for download on {} (minimum version: {})
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/b1a9832bf6a6a071.
Report an issue: GitHub.