OkerSoul
OkerSoul

Reputation: 21

ChromeDriver executable needs to be available in the path

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

Answers (2)

Kostyantyn
Kostyantyn

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

stvsmth
stvsmth

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:

  1. selenium <= 2.44.0 has a bug that hides the actual error messages from you; that is, the error ChromeDriver executable needs to be available in the path is bogus.
  2. If that bug didn't exist, it may well tell you Too many open files.

See my more detailed StackOverflow answer about the root issues involved. To fix the problem:

  • Increase max # of open files ... OR ...
  • 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

Related Questions