想学习一下爬虫,安装好selenium后,打开谷歌失败,请问怎么解决呢。
源码:1、导入seleniumfrom selenium import webdriver2、创建浏览器操作对象path = 'chromedriver.exe'browser = webdriver.Chrome(path)3、访问网站url = 'https://www.jd.com/'browser.get(url)
错误:
F:\pycharm_stu\crawler_learning\078_爬虫_selenium_基本使用.py:9: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
browser = webdriver.Chrome(path)
Traceback (most recent call last):
File "D:\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "D:\Python310\lib\subprocess.py", line 966, ininit
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\pycharm_stu\crawler_learning\078_爬虫_selenium_基本使用.py", line 9, in
browser = webdriver.Chrome(path)
File "D:\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, ininit
super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "D:\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, ininit
self.service.start()
File "D:\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
Process finished with exit code 1
webdriver位置放得对吗 配置的不对吧
页:
[1]