I am trying to do webscraping using Selenium in Chrome within Azure Databricks. Please find the below code.
%pip install selenium
%pip install webdriver_manager
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ExpectedConditions
from selenium.webdriver.chrome.options import Options
# Specify the path to the uploaded chromedriver file
chrome_driver_path = '/dbfs/FileStore/Chromedriver/chromedriver'
chrome_service = Service(chrome_driver_path)
# Configure Chrome options
options = Options()
options.binary_location = "C:\Program Files\Google\Chrome\Application"
options.add_argument('--headless') # Run Chrome in headless mode (without GUI)
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-gpu")
# Create a new Chrome webdriver instance
driver = webdriver.Chrome(service=chrome_service, options=options)
# Example usage: Open a website and print the page title
url = "https://data.cms.gov/tools/mapping-medicare-disparities-by-population"
driver.get(url)
# Clean up and quit the webdriver
driver.quit()
However I am getting below error - WebDriverException: Message: unknown error: no chrome binary at C:\Program Files\Google\Chrome\Application Stacktrace: