0

I am a beginner and trying to run chrome web driver. I used the following code in google colab.

from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd

options = webdriver.ChromeOptions()
options.add_argument('user-agent = Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver.exe')
driver.get('https://www.google.co.in')

It shows error in driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver.exe')

I have set the environment variable path for chromedriver as C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver but it still shows FileNotFoundError.

WebDriverException: Message: 'C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver.exe' executable needs to be in PATH

Can anyone help me with this?

  • when working on google colab, it can't access your local setup. Please try this [selenium on google colab?](https://stackoverflow.com/questions/56829470/selenium-google-colab-error-chromedriver-executable-needs-to-be-in-path) and let us know if works for you. it needs to be the headless instance. – simpleApp May 13 '21 at 13:01
  • great! you are welcome. – simpleApp May 13 '21 at 15:23

0 Answers0