问题:安装好Python和selenium后,运行如下代码准备打开Chrome浏览器时,报错如下:

代码:

from selenium import webdriver

dr=webdriver.Chrome()

执行结果:

win7 python3.6+selenium3.8.1运行chromedriver提示“Message: 'chromedriver' executable needs to be in PATH

解决方法:

1、下载chromedriver.exe并放到google安装目录下

C:\Program Files (x86)\Google\Chrome\Application

2、将安装路径C:\Program Files (x86)\Google\Chrome\Application添加到系统环境变量path里,保存即可

win7 python3.6+selenium3.8.1运行chromedriver提示“Message: 'chromedriver' executable needs to be in PATH

3、重新打开python编译器,运行代码即可成功


相关文章: