0

I want to get the chromedriver in executable path. I am using googlecolab to execute the code:

WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home 

is the error i am getting. Tried out the solutions previously given on this platform not getting the solution.Tried backslash,double slash,r"",automatic installation of driver which is giving version error etc Please suggest solution.

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("start-maximized") # https://stackoverflow.com/a/26283818/1689770
options.add_argument("enable-automation") # https://stackoverflow.com/a/43840128/1689770
options.add_argument("--no-sandbox") # https://stackoverflow.com/a/50725918/1689770
options.add_argument("--disable-infobars") # https://stackoverflow.com/a/43840128/1689770
options.add_argument("--disable-dev-shm-usage") # https://stackoverflow.com/a/50725918/1689770
options.add_argument("--disable-browser-side-navigation") # https://stackoverflow.com/a/49123152/1689770
options.add_argument("--disable-gpu");

wd1 = webdriver.Chrome('chromedriver', options = options)
wd1.get(page)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
R.R.P
  • 21
  • 1
  • 6

1 Answers1

0

Google Colaboratory

Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud which enables us to write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.

The entire colab runs in a cloud VM. If you investigate the VM you will find that the current colab notebook is running on top of Ubuntu 18.04.3 LTS.


This usecase

Incase you aren't sure where the ChromeDriver is getting downloaded you can move it to a known location and use it as follows:

!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!pip install selenium

from selenium import webdriver
wd = webdriver.Chrome('/usr/bin/chromedriver')

References

You can find a couple of detailed relevant discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) – R.R.P Aug 18 '20 at 05:49
  • @R.R.P It's all together a different issue. Your initial issue seems to be solved now. However, you aren't using `chromium-browser` but you are using [tag:google-chrome]. See [this discussion](https://stackoverflow.com/questions/53073411/selenium-webdriverexceptionchrome-failed-to-start-crashed-as-google-chrome-is/53078276#53078276) – undetected Selenium Aug 18 '20 at 05:52