Selenium gives “unknown error: cannot find Chrome binary” when running chrome driver on Ubuntu

前端 未结 4 674
不思量自难忘°
不思量自难忘° 2020-12-29 10:44

I am trying to run selenium [java] tests using chrome driver on Latest ubuntu.[16.04]

I am getting the following error/exception. As an experiment, I replaced Chrome

相关标签:
4条回答
  • 2020-12-29 11:16

    I found the problem. On my linux system, Google Chrome Browser was not installed.

    I was under the impression that ChromeDriver binary has got a browser implementation in it. Now I realized that's wrong , ChromeDriver binary is a selenium wrapper that calls Google Chrome.

    I must say that the exception message "selenium.WebDriverException: unknown error: cannot find Chrome binary" is confusing. If it was telling that "Chrome Browser is not installed" or something similar it would have been much easier.

    Thanks George

    0 讨论(0)
  • 2020-12-29 11:20

    It is issue with installation of Chrome on my Windows 10. Try to reinstall it on computer you got this issue.

    If it will not solve the problem use Gecko driver and Firefox.

    0 讨论(0)
  • 2020-12-29 11:23

    You may install Chrome through NPM:

    https://www.npmjs.com/package/chromium

    npm install chromium

    Then, map your chrome binary:

    const chromium = require('chromium');
    
    capabilities: [
        {
            browserName: 'chrome',
            'goog:chromeOptions': {
                binary: chromium.path
            },
        },
    ],
    
    0 讨论(0)
  • 2020-12-29 11:37

    Pointing to binary location, helped to fix the issue.

    Changed from :

    capabilities: {
        'browserName': 'chrome'
    }
    

    To:

    capabilities: {
        'browserName': 'chrome',
        "chromeOptions": {
          'binary': "C:\\Program Files (x86)\\Google\\Chrome Beta\\Application\\chrome.exe",
          args: [],
          extensions: [],
      }
    
    0 讨论(0)
提交回复
热议问题