"cannot find Chrome binary error" when running Selenium chrome driver in a Google Cloud instance (on jupyter Lab)

826 views Asked by At

I'm using a Jupyter Lab notebook which run on google cloud instance. After I installed chromedriver using the following command line:

wget https://chromedriver.storage.googleapis.com/85.0.4183.87/chromedriver_linux64.zip

then I unzip it with:

unzip chromedriver_linux64.zip

After which I run the following cell:

from selenium import webdriver

path = '/home/jupyter/chromedriver' 
driver = webdriver.Chrome(path) 

And this is where I get the error : WebDriverException: Message: unknown error: cannot find Chrome binary (I'm pretty sure the path to Chromedriver is right though)

This work perfectly on my local machine but I'm a bit lost as to why I can't have it work on a Google Cloud instance. Can you please help me out with this issue ? (Also I have tried other things by looking at other posts online but without success). Thank you

1

There are 1 answers

0
Nathan Nasser On

Here is an example on how to install Selenium on a Jupyter notebook.

It is recommended to install it wit pip:

!pip install selenium

and to import os and sys:

import os
import sys
os.path.dirname(sys.executable)