简体   繁体   中英

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

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM