关于Selenuim启动后缺少chromedriver的异常解决方法

今天在开始学习Selenuim的时候,browser=webdriver.Chrome()#创建一个Chrome WebDriver的实例,但是运行后出现以下异常:

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH

经过研究后,给出以下解决方案:

第一步:根据Chrome浏览器版本(http://blog.csdn.net/huilan_same/article/details/51896672)下载ChromeDriver(http://npm.taobao.org/mirrors/chromedriver/ 或者                       http://chromedriver.storage.googleapis.com/index.html

第二步:下载后解压,将chromedriver.exe拷贝到C:\Users\Andy\Anaconda3\Scripts(我用的是Anaconda3来安装的)

第三步:其实可以省略,因为在环境变量中已经进行了配置

亲测有效,这样就可以运行了!

猜你喜欢

转载自blog.csdn.net/qq_34623720/article/details/85760731