Reputation: 21
I'm using selenium webdriver python binding with the unittest
framework. My tests start failing when I repeat them. There are about 100 test cases in my suite.
After looping them three times the error message below appears
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'
my setUp
class and tearDown
methods are as follows:
def setUp(self):
self.driver=self.OpenBrowser(self.configDic['BrowserOption='])
def tearDown(self):
self.driver.quit()
I also found some Chromedriver processes in my task manager. Is this why the error message shows up? I've been paying attention to close every webdriver instance after using them. Is there any workaround for this situation?
Thank you guys for help.
Upvotes: 1
Views: 5875
Reputation: 5191
Had "ChromeDriver executable needs to be available in the path." error on Ubuntu 12.04 and Ubuntu 14.04.
Solved this way:
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
Upvotes: 1
Reputation: 3888
Since your question and later comments indicate you can run almost 300 tests (proving chromedriver IS in your PATH) I am guessing the problem is two-fold:
See my more detailed StackOverflow answer about the root issues involved. To fix the problem:
Add calls to close stdout
and stderr
in
site-packages/selenium/webdriver/chrome/service.py
try:
if self.process:
self.process.stdout.close() # <-- add this line
self.process.stderr.close() # <-- and this one
self.process.kill()
self.process.wait()
except OSError:
# kill may not be available under windows environment
pass
Upvotes: 0