ChromeDriver: Custom Chrome Executable Path

后端 未结 2 798
忘掉有多难
忘掉有多难 2021-01-01 05:10

I\'m using the portable version of Google Chrome.

Since WebDriver expects the default installation path, it does not find the portable one which obviously is at anot

相关标签:
2条回答
  • 2021-01-01 05:45

    Nevermind, I found the answer myself:

    ChromeOptions options = new ChromeOptions();
    options.setBinary("/path/to/chrome/binary");
    
    ChromeDriver driver = new ChromeDriver(options);
    

    Chromedriver docs

    0 讨论(0)
  • 2021-01-01 05:56

    Python version:

    chromedriver = "/path/to/chromedriver"
    options = Options()
    options.binary_location = '/path/to/chrome'
    driver = webdriver.Chrome(chromedriver, chrome_options=options)
    
    0 讨论(0)
提交回复
热议问题