Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome “错误”;找不到Chrome二进制文件“;在windows 8 AMD64中尝试启动selenium web驱动程序API时_Google Chrome_Selenium_Windows 8_Windows 8.1_Chrome Web Driver - Fatal编程技术网

Google chrome “错误”;找不到Chrome二进制文件“;在windows 8 AMD64中尝试启动selenium web驱动程序API时

Google chrome “错误”;找不到Chrome二进制文件“;在windows 8 AMD64中尝试启动selenium web驱动程序API时,google-chrome,selenium,windows-8,windows-8.1,chrome-web-driver,Google Chrome,Selenium,Windows 8,Windows 8.1,Chrome Web Driver,我目前正在windows 8 AMD64中使用selenium web驱动程序的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(executa

我目前正在windows 8 AMD64中使用selenium web驱动程序的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
放在了同一个路径中,它工作得很好;此路径已添加到系统路径。我还试着从另一台装有Windows7AMD64的计算机上启动它,它在那里工作得很好

我在谷歌上搜索了一下,我看到了;但是当我检查它为chrome.exe指定的路径时,我找不到chrome的可执行文件。我试图更新谷歌浏览器,但它给了我错误代码1

我也试过:

opts = webdriver.ChromeOptions()
opts.binary_location(value = "C:\\WebDrivers\\chromedriver.exe")
driver = webdriver.Chrome(chrome_options = opts)

我该怎么办?

错误的最后一行是重要的一行:

selenium.common.exceptions.WebDriverException:消息:u'未知错误:找不到Chrome二进制文件\n(驱动程序信息:chromedriver=2.9.248315,平台=Windows NT 6.2 x86_64)'


ChromeDriver已找到,它报告找不到chrome浏览器可执行文件。确保已安装并位于当前路径上。一些附加信息在上。

我使用
色度选项解决了这个问题
;我从
ProgramFiles
目录中寻址了chrome的二进制文件。这是我使用的代码:

opts = webdriver.ChromeOptions()
opts.binary_location(value = "C:\\ProgramFiles\\Google\\Chrome\\chrome.exe")
driver = webdriver.Chrome(chrome_options = opts)

您必须在安装chrome的位置设置
可执行路径,这是ruby风格。我认为python可能与此相同

Selenium::WebDriver::Chrome::Service.executable_path=“D:/Program Files(x86)/Chrome/Chrome.exe”

对我来说这是

opts = webdriver.ChromeOptions()
opts.binary_location = "path/to/Chrome.exe"
driver = webdriver.Chrome(chrome_options=opts)

这解决了问题

谢谢你的回答,但我已经知道了;正如我提到的,我找不到chrome的可执行文件。我不知道这个应用程序有什么问题。你在这台机器上安装了Chrome浏览器吗?我不明白。如果您找不到可执行文件,那么您如何使用它?我没有在机器上安装Chrome,安装它解决了这个问题。万一有人看到类似的东西,谢谢。我按照这个步骤在centos上安装了chrome浏览器,感谢您的回复!是的,我实际上在python中使用了相同的方法。你可以查看我的回复!在我的例子中,此代码导致TypeError:“str”对象不可调用。正如所建议的,二进制_位置将直接分配。