Python FileNotFoundError,WebDriverException

Python FileNotFoundError,WebDriverException,python,selenium-chromedriver,google-colaboratory,Python,Selenium Chromedriver,Google Colaboratory,我是一名初学者,正在尝试运行chrome web驱动程序。我在GoogleColab中使用了以下代码 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.3

我是一名初学者,正在尝试运行chrome web驱动程序。我在GoogleColab中使用了以下代码

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')
它显示
driver=webdriver.Chrome(Chrome\u options=options,executable\u path=r'C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver.exe)中的错误。

我已经将chromedriver的环境变量路径设置为
C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver
,但它仍然显示FileNotFoundError

WebDriverException:消息:“C:\Users\write\AppData\Local\Programs\Python\Python39\chromedriver.exe”可执行文件需要位于路径中


有人能帮我吗?

在使用google colab时,它无法访问您的本地设置。请试试这个,让我们知道是否适合你。它需要是headless实例。谢谢@simpleApp它工作了!不客气。