我目前正在使用 Windows 8 AMD64 中 selenium web-driver 的 Chrome 扩展。我在启动 Chrome 时遇到问题;它给了我这个:
Traceback (most recent call last):
File "D:/java/code/SVN/OMC/trunk/Test/Scripts/PMS\elements\UILoader.py", line 164, in __init__
self.driver = webdriver.Chrome(executable_path="F:\\driver\\chromedriver.exe")
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 65, in __init__
keep_alive=True)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 73, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 121, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 173, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'unknown error: cannot find Chrome binary\n (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.2 x86_64)'
我也IEDriverServer.exe
采用了相同的路径,并且效果很好;此路径已添加到系统 PATH。我还尝试从另一台装有 Windows 7 AMD64 的计算机上启动它,它在那里工作正常。
我用谷歌搜索了一下,我看到了这个;但是当我检查它指定的路径时chrome.exe
,我找不到 chrome 的可执行文件。我试图更新谷歌浏览器,但它给了我错误代码 1。
我也试过这个:
opts = webdriver.ChromeOptions()
opts.binary_location(value = "C:\\WebDrivers\\chromedriver.exe")
driver = webdriver.Chrome(chrome_options = opts)
我应该怎么办?