Install chromedriver Automatically while using Selenium in Python

pip install webdriver-manager
service = Service(executable_path=ChromeDriverManager().install())
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--start-maximized")
chrome_options.add_experimental_option("useAutomationExtension", False)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
# Add headless option
chrome_options.add_argument("--headless")
self.driver = webdriver.Chrome(options=chrome_options, service=service)