2013-10-18 121 views
1

我想使用Python的分裂库来运行网页测试。问题是我无法得到chromedriver可执行文件的位置是正确的。每次我尝试运行一个文件,我得到在Ubuntu上安装Chromedriver使用分裂

Traceback (most recent call last): 
File "autoCookie.py", line 7, in <module> 
browser = Browser('chrome') 
File "/usr/local/lib/python2.7/dist-packages/splinter/browser.py", line 44, in Browser 
return driver(*args, **kwargs) 
File "/usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/chrome.py", line 23, in __init__ 
self.driver = Chrome(chrome_options=options, **kwargs) 
File "/usr/local/lib/python2.7/dist-packages/selenium-2.36.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 59, in __init__ 
self.service.start() 
File "/usr/local/lib/python2.7/dist-packages/selenium-2.36.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 68, in start 
and read up at http://code.google.com/p/selenium/wiki/ChromeDriver") 
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.     Please download from http://code.google.com/p/chromedriver/downloads/list    and read up at http://code.google.com/p/selenium/wiki/ChromeDriver' 

我已经改变了目录的每一个位置在网络上的建议,我通过碎片网站上的安装过程中跑了,我尝试使用os.environ设置它,我已经在selenium文件夹中的webdrive.py文件中编辑了代码,我尽我所能地在互联网上找到了所有可以找到的东西,但仍然出现此错误。另外,当我使用browser = Browser(“firefox”)运行程序时,程序运行正常,但是一旦我到达click()函数,它就会退出并显示错误消息。但这是一个不同的问题,我宁愿只是让它在Chrome中工作。我愿意接受任何建议,我只希望在这里有人能帮助我。提前致谢!

其他信息:

操作系统:Ubuntu的13.04,Python 2.7版,硒2.36.0,chromedriver_linux64

回答

0

什么是你的PYTHONPATH和PATH设置为?

>>> import os 
>>> import sys 
>>> os.environ['PYTHONPATH'].split(os.pathsep) 
>>> sys.path 

您的ChromeDriver可执行文件在哪里?它需要位于上面返回的目录之一中。