{"id":1091,"hash":"3db1a10654f3ee195a8f3bd4ea2a0fa98aebbea33abc34da2fa9dc624ee848df","pattern":"DeprecationWarning: executable_path has been deprecated selenium python","full_message":"I am using sublime to code python scripts. The following code is for selenium in python to install the driver automatically by using the webdriver_manager package\n\n# pip install webdriver-manager\nfrom selenium import webdriver\nfrom selenium.webdriver.chrome.service import Service\nfrom webdriver_manager.chrome import ChromeDriverManager\nfrom selenium.webdriver.common.by import By\n\ndriver = webdriver.Chrome(ChromeDriverManager().install())\ndriver.maximize_window()\n\n#s=Service(path)\n#driver=webdriver.Chrome(service=s)\ndriver.get('https://www.google.com')\ndriver.find_element(By.NAME, 'q').send_keys('Yasser Khalil')\n\nThe code works fine but I got a warning like that\n\nDemo.py:7: DeprecationWarning: executable_path has been deprecated, please pass in a Service object\n  driver = webdriver.Chrome(ChromeDriverManager().install())\n\nHow to fix such a bug?","ecosystem":"pypi","package_name":"selenium","package_version":null,"solution":"This error message...\n\nDeprecationWarning: executable_path has been deprecated, please pass in a Service object\n\n...implies that the key executable_path will be deprecated in the upcoming releases.\n\nThis change is inline with the Selenium 4.0 Beta 1 changelog which mentions:\n\nDeprecate all but Options and Service arguments in driver instantiation. (#9125,#9128)\n\nSolution\nWith selenium4 as the key executable_path is deprecated you have to use an instance of the Service() class along with ChromeDriverManager().install() command as discussed below.\n\nPre-requisites\nEnsure that:\n\nSelenium is upgraded to v4.0.0\n\npip3 install -U selenium\n\nWebdriver Manager for Python is installed\n\npip3 install webdriver-manager\n\nYou can find a detailed discussion on installing Webdriver Manager for Python in ModuleNotFoundError: No module named 'webdriver_manager' error even after installing webdrivermanager\n\nSelenium v4 compatible Code Block\nfrom selenium import webdriver\nfrom selenium.webdriver.chrome.service import Service\nfrom webdriver_manager.chrome import ChromeDriverManager\n\ndriver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))\ndriver.get(\"https://www.google.com\")\n\nConsole Output:\n\n[WDM] - ====== WebDriver manager ======\n[WDM] - Current google-chrome version is 96.0.4664\n[WDM] - Get LATEST driver version for 96.0.4664\n[WDM] - Driver [C:\\Users\\Admin\\.wdm\\drivers\\chromedriver\\win32\\96.0.4664.45\\chromedriver.exe] found in cache\n\nYou can find a detailed discussion on installing Webdriver Manager for Python in Selenium ChromeDriver issue using Webdriver Manager for Python\n\nIncase you want to pass the Options() object you can use:\n\nfrom selenium import webdriver\nfrom selenium.webdriver.chrome.options import Options\nfrom selenium.webdriver.chrome.service import Service\nfrom webdriver_manager.chrome import ChromeDriverManager\n\noptions = Options()\noptions.add_argument(\"start-maximized\")\ndriver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)\ndriver.get(\"https://www.google.com\")\n\nTL; DR\nYou can find the relevant Bug Report/Pull Request in:\n\nBug Report: deprecate all but Options and Service arguments in driver instantiation\nPull Request: deprecate all but Options and Service arguments in driver instantiation","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/64717302/deprecationwarning-executable-path-has-been-deprecated-selenium-python","votes":204,"created_at":"2026-04-19T04:52:19.396733+00:00","updated_at":"2026-04-19T04:52:19.396733+00:00"}