Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium executable_path has been deprecated

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')
like image 685
Cordell Jones Avatar asked Oct 24 '25 12:10

Cordell Jones


1 Answers

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

like image 109
Prophet Avatar answered Oct 27 '25 01:10

Prophet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!