Chromedriver unexpectedly exited. status code was: 127

Hi All,

I am getting below issue while running test with python selenium
Error: chromedriver unexpectedly exited. status code was: 127

Code:
chrome_version = “124.0.6367.78”
chrome_driver_path = ChromeDriverManager(driver_version=chrome_version).install()
logging.info(f"chrome driver path: {chrome_driver_path}")
options = webdriver.ChromeOptions()
service = Service(executable_path=chrome_driver_path)
self.driver = webdriver.Chrome(service=service, options=options)

I am using webdriver-manager==4.0.1 and selenium==4.15.2 versions.

Kindly help me to resolve this issue.

Thanks in advance.

To help you we will need the following information from you:

  1. Your OS name and version.
  2. Your python version.
  3. Any development tools name and version you are using like Visual Studio Code, Pycharm, etc.
  4. The smallest complete program to illustrate the error.
  5. What were you trying to do when the error happened? Which line of code caused the error?

Hi,

  1. Your OS name and version.
    OS: linux (It is EC2 instance, which is configured by devops team)
  2. Your python version.
    Python version: 3.11.5
  3. Any development tools name and version you are using like Visual Studio Code, Pycharm, etc. → not using any of these tools.
  4. The smallest complete program to illustrate the error.
  5. What were you trying to do when the error happened? Which line of code caused the error?
    chrome_version = “124.0.6367.78”
    chrome_driver_path = ChromeDriverManager(driver_version=chrome_version).install()
    logging.info(f"chrome driver path: {chrome_driver_path}“)
    options = webdriver.ChromeOptions()
    service = Service(executable_path=chrome_driver_path)
    self.driver = webdriver.Chrome(service=service, options=options)
    here it is failing
    def assert_process_still_running(self) → None:
    “”“Check if the underlying process is still running.”“”
    return_code = self.process.poll()
    if return_code:
    ** raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}”)**
    ** selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/124.0.6367.78/chromedriver-linux64/chromedriver unexpectedly exited. Status code was: 127**

What is the program supposed to do?

Just need to download chrome driver using chrome driver manager and open some url and perform actions according to my test case.

But it is failing at the beginning before opening url.

My issue is very similar to python - Running Selenium file in Amazon AWS - Stack Overflow
kindly help me what needs to be done