Understanding Selenium WebDriverException: Status Code 127

What will you learn?

In this tutorial, you will delve into the common error “selenium.common.exceptions.WebDriverException: Status code was: 127” in Python. You’ll gain insights into why this error occurs and how to effectively troubleshoot and resolve it.

Introduction to Problem and Solution

When utilizing Selenium, a powerful tool for automating web browsers with Python, encountering errors is inevitable. One of the frequent errors is selenium.common.exceptions.WebDriverException: Status code was: 127. This error typically indicates that the WebDriver executable required for browser automation is either missing or inaccessible.

To address this issue, it’s crucial to understand that status code 127 commonly signifies a “command not found” problem on Unix-like systems. In the context of Selenium, it suggests issues with locating or executing the WebDriver. The solution involves verifying proper installation and configuration by ensuring correct paths and environment setup.

from selenium import webdriver
import os

# Specify the path to your WebDriver (e.g., ChromeDriver)
driver_path = "/path/to/your/chromedriver"
os.environ["webdriver.chrome.driver"] = driver_path

# Instantiate a browser object (Chrome in this example)
browser = webdriver.Chrome(driver_path)

# Interact with web pages using the `browser` object

# Copyright PHD


By setting up the WebDriver path and environment variable correctly, as shown in the code snippet above, you can mitigate status code 127 errors related to missing executables. Here are some key points to consider:

  • Download: Ensure you have downloaded the appropriate WebDriver for your browser.
  • Path Verification: Confirm that the specified driver path is accurate.
  • Permissions: Check executable permissions on Unix-like systems.
  • Environment Variables: Setting up environmental variables can aid in dynamic path resolution.
  1. How do I install ChromeDriver?

  2. You can download ChromeDriver from its official website based on your browser version and OS. Extract it to a known location referenced in your Python script.

  3. What does status code 127 indicate?

  4. Status code 127 signifies a ‘command not found’ error in Unix/Linux environments due to issues locating or invoking an executable properly.

  5. Can similar issues occur with browsers other than Chrome?

  6. Yes, similar problems may arise with browsers like Firefox (GeckoDriver), Safari, etc., if their respective drivers are not detected by Selenium scripts.

  7. Is there an alternative to specifying absolute paths?

  8. Absolutely! Placing WebDriver binaries within your system’s PATH allows automatic discovery without hardcoding paths in scripts.

  9. How can I update my PATH on Windows?

  10. Navigate to System Properties > Advanced > Environment Variables and modify/add PATH variables containing directories with WebDriver binaries.


Resolving “WebDriverException: Status Code 127” involves understanding installation setups and configurations when working with tools like Selenium. By following the outlined solutions and troubleshooting steps, you can effectively tackle challenges related to automated web testing scenarios. Embrace these foundational concepts to achieve successful outcomes in your projects confidently.

Leave a Comment