SeleniumHQ/selenium · error · WebDriverException
Unsuccessful command executed: {command}
Error message
Unsuccessful command executed: {command} What it means
Raised by SeleniumManager._run() inside a broad 'except Exception' around the subprocess.run call and the subsequent json.loads of stdout. It wraps ANY exception from launching the process or parsing its output, chaining the original via 'from err'. The message shows only the command string, so inspecting the chained exception (__cause__) is essential for the real cause.
Source
Thrown at py/selenium/webdriver/common/selenium_manager.py:149
Args:
args: the components of the command being executed.
Returns:
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
- Check the chained exception: print the full traceback to read __cause__ (e.g. PermissionError, OSError 'Exec format error').
- Ensure the binary is executable: chmod +x on the resolved path returned by the error.
- If an ELF loader error appears, the binary does not match your kernel/architecture — set SE_MANAGER_PATH to a correct one or rebuild from rust/.
- On BSD, run 'brandelf -t linux' on the binary and load the linux64 kernel module as the earlier warning suggests.
Example fix
# before — broad error hides root cause
# WebDriverException: Unsuccessful command executed: /path/selenium-manager ...
# after — surface the chained cause
import traceback, logging
logging.basicConfig(level=logging.DEBUG)
try:
driver = webdriver.Chrome()
except Exception:
traceback.print_exc() # prints __cause__ (PermissionError / OSError / JSONDecodeError) Defensive patterns
Strategy: try-catch
Validate before calling
import os, stat
from selenium.webdriver.common.selenium_manager import SeleniumManager
p = SeleniumManager._get_binary()
st = p.stat()
if not (st.st_mode & stat.S_IXUSR):
raise PermissionError(f'{p} is not executable; run chmod +x') Type guard
null
Try / catch
from selenium.common.exceptions import WebDriverException
try:
driver = webdriver.Chrome()
except WebDriverException as e:
cause = e.__cause__
if isinstance(cause, PermissionError):
os.chmod(SeleniumManager._get_binary(), 0o755)
elif isinstance(cause, OSError):
# wrong arch / missing libs — rebuild or set SE_MANAGER_PATH
... Prevention
- Enable DEBUG logging to see the command that failed.
- Always inspect __cause__ on this exception, not just the message.
- Verify the binary matches the host architecture before deploying.
When it happens
Trigger: The selenium-manager binary cannot be executed at all: permission denied (not chmod +x), exec format error (wrong binary for the kernel/architecture), the process is killed by the OS, or the binary prints non-JSON output (e.g. a shared-library error message) causing json.JSONDecodeError.
Common situations: Binary downloaded for the wrong architecture, missing execute bit after a manual copy, missing shared libraries on a minimal Linux container (glibc/musl mismatch), or an SELinux/AppArmor policy denying execution. Also seen when FreeBSD/OpenBSD users run the Linux binary without Linux compatibility loaded.
Related errors
- Unsuccessful command executed: {command}; code: {completed_p
- Unsuccessful command executed: #{command}; #{e.message}
- Invalid permission state. Must be one of: ${Object.values(Pe
- Unable to obtain browser driver. For more informatio
- Unable to obtain Selenium Manager at ${filePath}
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/5611dd24aa507bba.
Report an issue: GitHub.