Chrome driver 安装及问题
2017-07-04 14:05
716 查看
chrome driver
模拟浏览器对网站进行请求。
安装
chromedriver下载地址:https://sites.google.com/a/chromium.org/chromedriver/downloads
注:chrome版本
解压得到chromedriver.exe文件
将解压后的exe文件放到chrome的安装目录下...\Google\Chrome\Application\ (我的Chrome安装目录: C:\Program Files (x86)\Google\Chrome\Application )根据自己的chrome浏览器的路径
配置环境变量:
设置path环境变量,把chrome的安装目录添加至环境变量(chromedriver.exe不要加入路径)
测试:
#coding:utf-8
from selenium import webdriver
import time
def main():
b=webdriver.Chrome()
b.get('http://www.baidu.com')
time.sleep(5)
b.quit()
if __name__ == '__main__':
main()
问题:
出现selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.
import os
from selenium import webdriver
chromedriver = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
driver = webdriver.Firefox()
driver.get('http://stackoverflow.com')
driver.quit()
执行没有问题,说明环境变量配置错误,那就重新返回上面配置吧
模拟浏览器对网站进行请求。
安装
chromedriver下载地址:https://sites.google.com/a/chromium.org/chromedriver/downloads
注:chrome版本
解压得到chromedriver.exe文件
将解压后的exe文件放到chrome的安装目录下...\Google\Chrome\Application\ (我的Chrome安装目录: C:\Program Files (x86)\Google\Chrome\Application )根据自己的chrome浏览器的路径
配置环境变量:
设置path环境变量,把chrome的安装目录添加至环境变量(chromedriver.exe不要加入路径)
测试:
#coding:utf-8
from selenium import webdriver
import time
def main():
b=webdriver.Chrome()
b.get('http://www.baidu.com')
time.sleep(5)
b.quit()
if __name__ == '__main__':
main()
问题:
出现selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.
提示chrome driver没有放置在正确的路径下,于是下载chrome dirver,然后放置到chrome所在的目录下,再次运行就OK了!
用下面这种方式检验是路径错误还是安装错误:import os
from selenium import webdriver
chromedriver = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
driver = webdriver.Firefox()
driver.get('http://stackoverflow.com')
driver.quit()
执行没有问题,说明环境变量配置错误,那就重新返回上面配置吧
相关文章推荐
- vue-cli搭建中遇到的chromedriver安装失败问题解决
- 解决@vue/cli 创建项目是安装chromedriver时失败的问题
- 安装chrome driver出现的问题
- 解决npm install时报错无法安装chromedriver的问题
- 解决@vue/cli 创建项目是安装chromedriver时失败的问题
- MongoDB C++ 2.4.5 driver 编译安装问题
- Chrome安装Debug版FlashPlayer常见的问题
- 64位机器安装mongo-php-driver问题及解决办法
- 天天记录 - Chrome安装问题记录
- Chrome 11的安装问题
- Axure生成原型时,有Install Axure RP Extension 0.5 for Chrome提示,安装后,仍不能解决问题?
- MongoDB C++ 2.4.6 driver 编译安装问题
- 配置chrome编译环境,安装windows sdk 6.1出现的问题。
- ubuntu13.04安装chrome依赖问题解决方法
- 遇到问题----------安装DBD:mysql时报错install_driver(mysql) failed: Can't load '/usr/lib64/perl5/site_perl/5.8
- Centos下安装chrome以及引发地进程调度的一些问题
- Chrome安装Debug版FlashPlayer常见的问题
- 黄聪:Google浏览器chrome下安装WordPress中文乱码问题
- 找不到 Driver do Microsoft Access (*.mdb) ODBC 驱动程序的安装例程 请大神帮忙 解决问题
- 新版Chrome手动安装flashplayer plugin无效的问题