Selenium WebDriver - Could not find Chrome binary

后端 未结 7 1194
轮回少年
轮回少年 2021-02-14 09:45

I\'m trying to get Selenium tests running with Chrome. I\'m using C#.

var options = new OpenQA.Selenium.Chrome.ChromeOptions();
options.BinaryLocation = @\"C:\\U         


        
相关标签:
7条回答
  • 2021-02-14 10:08

    Download "chromedriver_win_22_0_1203_0b.zip" extract it and set the path as below: (I have set my path)

    options.BinaryLocation = @"F:\\Software Download_Ripon\\WebDriver\\chromedriver_win_22_0_1203_0b\\chromedriver.exe";
    

    The above should work well

    0 讨论(0)
  • 2021-02-14 10:14

    In the path you have given for Chrome binary please specify the chrome.exe as well. It will work!

    0 讨论(0)
  • 2021-02-14 10:21

    Isn't the problem that you're missing the chrome.exe at the end of the path?

    In other words, the path should include the executable, rather than just being the folder in which the executable is located.

    0 讨论(0)
  • 2021-02-14 10:22

    you should have installed chrome in your machine

    and your chromedriver.exe version should accordingly to chrome download form

    https://chromedriver.chromium.org/downloads

    and given new chromedriver.exe path to your script..

    This works well for me

    0 讨论(0)
  • 2021-02-14 10:24

    This is a typical problem in some localized Windows XP distributions.

    I describe a solution for Python because it is different, without CamelCase property BinaryLocation identifier and it is less documented. Yes, a general solution is to create a new instance of ChromeOptions, but it is possible simply to fix the bug dynamically directly by ChromeOptions by some code started first somewhere:

    from selenium import webdriver
    webdriver.ChromeOptions.binary_location = ur"c:\Documents and Settings\user name\Local Settings\Data aplikací\Google\Chrome\Application\chrome.exe"
    

    and leave all other code unchanged:

    from selenium import webdriver
    browser = webdriver.Chrome()
    

    It is important to use ur"..." unicode raw string literal in Python (not byte string, if the path contains international characters) and not normal u"..." if the the complete path is hardcoded and the username starts with some character special after \ like \n \r \t.

    0 讨论(0)
  • 2021-02-14 10:25

    1. I reinstalled chrome and made sure it exists in the given folder.
    2. Made sure the selenium project is in the repos and not on desktop
    3. Updated all the drivers using Manage Nuget Packages
    0 讨论(0)
提交回复
热议问题