我正在使用 selenium webdriver python 与 unittest
框架绑定(bind)。当我重复测试时,我的测试开始失败。我的套件中有大约 100 个测试用例。
循环三遍后,出现以下错误消息
Traceback (most recent call last):
File "TestPlan.py", line 26, in setUp
self.driver=self.OpenBrowser(self.configDic['BrowserOption='])
File "D:\AutoTest-Selenium\Controller.py", line 85, in OpenBrowser
File "C:\Python27\lib\selenium\webdriver\chrome\webdriver.py", line 59, in __init__
WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.
Please download from http://chromedriver.storage.googleapis.com/index.html
and read up at http://code.google.com/p/selenium/wiki/ChromeDriver'
我的setUp
类和tearDown
方法如下:
def setUp(self):
self.driver=self.OpenBrowser(self.configDic['BrowserOption='])
def tearDown(self):
self.driver.quit()
我还在任务管理器中发现了一些 Chromedriver 进程。这就是出现错误消息的原因吗?我一直注意在使用它们后关闭每个网络驱动程序实例。对于这种情况有什么解决方法吗?
谢谢大家的帮助。
最佳答案
在 Ubuntu 12.04 和 Ubuntu 14.04 上出现“ChromeDriver 可执行文件需要在路径中可用。”错误。
这样解决:
sudo -i
wget http://chromedriver.storage.googleapis.com/2.15/chromedriver_linux64.zip
unzip chromedriver_linux64.zip -d /usr/local/bin
chmod 755 /usr/local/bin/chromedriver
关于python - ChromeDriver 可执行文件需要在路径中可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26477603/