4

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')
Prophet
  • 32,350
  • 22
  • 54
  • 79
Cordell Jones
  • 93
  • 1
  • 8

2 Answers2

4

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

Prophet
  • 32,350
  • 22
  • 54
  • 79
3

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

In this it have to pass the service object.

from selenium.webdriver.chrome.service import Service

service = Service("path of execution")
driver = webdriver.Chrome(service=service)

From this it will work.