Webdriverexception: Message: Service Chromedriver Unexpectedly Exited. Status Code Was: 127

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 3221225477

This error message...

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 3221225477

...implies that the ChromeDriver unexpectedly exited.


Status code: 3221225477

As per the documentation in Program exit codes Status Code 3221225477 implies Access violation which indicates that the executed program has terminated abnormally or crashed.

As you are using ChromeDriver / Chrome combination there can be numerous reason for this error. A couple of them are as follows:

  • Due to incorrect ChromeDriver path.

You can find a detailed discussion in WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

  • Due to ChromeDriver / Chrome version mismatch.

You can find a detailed discussion in WebDriverException: Message: Service /content/chromedriver unexpectedly exited. Status code was: -6 with ChromeDriver Google Colab and Selenium

Service chromedriver unexpectedly exited. Status code was: -9

xattr -d com.apple.quarantine /usr/local/bin/chromedriver

/usr/local/bin/chromedriver replace with actual path

WebDriverException: Message: Service /content/chromedriver unexpectedly exited. Status code was: -6 with ChromeDriver Google Colab and Selenium

I have found the answer to the question about why I was getting an error. Please install the chromium-chromedriver and add it to your path variable as well as the bin directory.

This is the fully-fledged solution to the problem of how to scrape data using Selenium on Colab. There is one more method by using PhantomJS but this API has been deprecated by Selenium and hopefully they will remove it in the next Selenium update.

# install chromium, its driver, and selenium
!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!pip install selenium
# set options to be headless, ..
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
# open it, go to a website, and get results
wd = webdriver.Chrome('chromedriver',options=options)
wd.get("https://www.website.com")
print(wd.page_source) # results

This would work for anyone who want to scrape their data on Google Colab and not on your local machine. Please execute the steps as shown sequentially in the same order.

You can find the notebook here https://colab.research.google.com/drive/1GFJKhpOju_WLAgiVPCzCGTBVGMkyAjtk .



Related Topics



Leave a reply



Submit