Home > OS >  Selenium executable_path has been deprecated
Selenium executable_path has been deprecated

Time:03-15

When running my code I get the below error string,

<string>:36: DeprecationWarning: executable_path has been deprecated, please pass in a Service object

What could possibly be the issue? Below is the Selenium setup,

options = webdriver.ChromeOptions()
prefs = {"download.default_directory" : wd}
options.add_experimental_option("prefs", prefs)
options.add_argument("--headless")
path = (chrome)
driver = webdriver.Chrome(executable_path=path, options = options)
driver.get('https://www.1linelogin.williams.com/1Line/xhtml/login.jsf?BUID=80')

CodePudding user response:

This error message

DeprecationWarning: executable_path has been deprecated, please pass in a Service object

means that the key executable_path will be deprecated in the upcoming releases.

Once the key executable_path is deprecated you have to use an instance of the Service() class as follows:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

path = (chrome)
s = Service(path)
driver = webdriver.Chrome(service=s)

For more details see here

  • Related