when running my code I get the following error
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options)`
I understand that the error is saying the executable_path has been depreciated, but I am not seeing where I replace that with the Service() class. my experience with python is limited and would appreciate any guidance.
Here is the code I am running:
from datetime import datetime
import csv
import unidecode
import time
from bs4 import BeautifulSoup
import requests
import os
import json
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
def driverInitialize():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--no-sandbox")
#chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("--dns-prefetch-disable")
chrome_options.add_argument('ignore-certificate-errors')
prefs = {"profile.managed_default_content_settings.images": 2}
chrome_options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options)
#driver=webdriver.Chrome(options=chrome_options)
driver.set_page_load_timeout(300)
return driver