You can set Chrome Browser Binary location through ChromeDriver using Python ing the following different ways:
Using Options
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Utility/BrowserDrivers/chromedriver.exe", )
driver.get('http://google.com/')
Using DesiredCapabilities
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
cap = DesiredCapabilities.CHROME
cap = {'binary_location': "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"}
driver = webdriver.Chrome(desired_capabilities=cap, executable_path="C:\Utility\BrowserDrivers\chromedriver.exe")
driver.get('http://google.com/')
Using Chrome as a Service
from selenium import webdriver
import selenium.webdriver.chrome.service as service
service = service.Service('C:\Utility\BrowserDrivers\chromedriver.exe')
service.start()
capabilities = {'chrome.binary': "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"}
driver = webdriver.Remote(service.service_url, capabilities)
driver.get('http://www.google.com')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…