cannot find chrome binary while running code

cannot find chrome binary while running code

Problem Description:

I am so new to python and selenium
I am trying to make a script that checks if an element (date in a datepicker) is enabled or disabled

I always get this error :
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

this is the code :


import datetime
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By

driver_service = Service(executable_path=r"C:UsersAdminDesktopTestchromedriver.exe")
driver = webdriver.Chrome(service=driver_service)
options = webdriver.ChromeOptions()
options.binary_location = r"C:UsersAdminAppDataLocalGoogleChromeApplicationchrome.exe"


url = "URL"
browser = webdriver.Chrome(executable_path=r"C:UsersAdminDesktopTestchromedriver.exe")
browser.get(url)



def next_7_dates():
    today = datetime.datetime.today()
    date_list = []
    for x in range(0,7):
        new_date = today + datetime.timedelta(days=x)
        date_list.append(new_date.strftime('%Y-%m-%d'))
    return date_list



Available_date = browser.find_element_by_xpath("/html/body/div[1]/span/form/div/div[2]/div[8]")
Free = find_element_by_class_name("bg-disabled")
if Free.is_enabled():
     print("No Appointments available")

I am new to I am pretty much testing stuff

Solution – 1

You were almost there. You just need to supply the arguments properly and supply the lines of code in proper sequence as follows:

driver_service = Service(r"C:UsersAdminDesktopTestchromedriver.exe")
options = webdriver.ChromeOptions()
options.binary_location = r"C:UsersAdminAppDataLocalGoogleChromeApplicationchrome.exe"
driver = webdriver.Chrome(service=driver_service, , options=options)
url = "URL"
browser.get(url)
Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject