鱼C论坛

 找回密码
 立即注册
查看: 7026|回复: 7

学习selenium过程中,求chromedriver的下载资源和安装方法

[复制链接]
发表于 2016-8-25 04:09:19 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
如题哈~
网上找了很多,依葫芦画瓢但一直报错:
Traceback (most recent call last):
  File "C:\p352\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\p352\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\p352\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    brw = wdr.Chrome()
  File "C:\p352\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\p352\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2016-8-25 07:26:56 | 显示全部楼层
http://chromedriver.storage.googleapis.com/index.html?path=2.23/
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-8-25 09:37:52 | 显示全部楼层

我目前的安装方法是,将解压的chromedriver.exe放到与chrome.exe同级的目录"C:\Program Files (x86)\Google\Chrome\Application\"下面,然后加入环境变量"C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
是不是哪里不对?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-8-25 10:39:22 | 显示全部楼层

学习selenium过程中,求chromedriver的安装方法

本帖最后由 jfjjx 于 2016-8-25 11:00 编辑

如题哈~
我目前的安装方法是,将解压的chromedriver.exe放到与chrome.exe同级的目录"C:\Program Files (x86)\Google\Chrome\Application\"下面,然后加入环境变量"C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
是不是哪里不对?
网上找了很多,依葫芦画瓢但一直报错:
Traceback (most recent call last):
  File "C:\p352\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\p352\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\p352\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    brw = wdr.Chrome()
  File "C:\p352\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\p352\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-8-25 11:50:37 | 显示全部楼层
jfjjx 发表于 2016-8-25 10:39
如题哈~
我目前的安装方法是,将解压的chromedriver.exe放到与chrome.exe同级的目录"C:\Program Files (x ...

手动指定吧
driver = webdriver.Chrome("C:/Users/michael/Downloads/chromedriver_win32/chromedriver.exe")
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-8-25 12:58:24 | 显示全部楼层
from selenium import webdriver

brw= webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
brw.get('http://www.baidu.com/')
代码如上,python版本3.5.1。chrome浏览器是正常打开的,但是没有自动进入http://www.baidu.com/页面


出错界面

出错界面
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-8-26 08:18:30 | 显示全部楼层
自顶
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-4-8 13:52:06 | 显示全部楼层
我现在的问题和你一样,无法用..
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-7-7 18:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表