您的位置:首页 > 其它

WebDriverException: Message: 'IEDriverServer.exe' executable needs to be in PATH. Please download fr

2016-12-27 19:57 831 查看
详细描述:想用chrome浏览器来执行测试用例,按照官方文档http://code.google.com/p/selenium/wiki/ChromeDriver 的步骤操作后还是报WebDriverException: Message: 'ChromeDriver executable needs to be available in path的错,配了系统环境变量重启后也没用。

问题解决:最后在stackoverflow上找到答案,原答案地址:

http://stackoverflow.com/questions/8255929/running-webdriver-chrome-with-selenium

用下面这种方法设环境变量就ok啦:

import os

from selenium import webdriver

chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

os.environ["webdriver.chrome.driver"] = chromedriver

driver = webdriver.Chrome(chromedriver)

driver.get("http://stackoverflow.com")

driver.quit()

2.我相信很多人会去手写Python脚本

请大家注意调用浏览器首字母要大写,如:Firefox,Chrome,Ie

3.注意得把IEDriverServer跟chromedriver放到对应浏览器的安装目录下

配置浏览器的环境变量Path:如

Chrome:C:\Users\wyx\AppData\Local\Google\Chrome\Application

4.在python的安装目录下也放IEDriverServer,chromedriver
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐