Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to open chrome webdriver with selenium But I am facing following error DeprecationWarning: executable_path has been deprecated, please pass in a Service object in Python. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
- How DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error Occurs ?
- How To Solve DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error ?
- Solution 1: Just use an instance of the Service()
- Solution 2: Use this code
- Solution 3: Before and after
- Summary
How DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error Occurs ?
I am trying to open chrome webdriver with selenium But I am facing following error.
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
How To Solve DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error ?
How To Solve DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error ?
To Solve DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error Here
executable_path
is deprecated you have to use an instance of theService()
class as follows. s = Service(‘C:/Users/…/chromedriver.exe’) and then driver = webdriver.Chrome(service=s) Now, Your error must be solved.DeprecationWarning: executable_path has been deprecated, please pass in a Service object
To Solve DeprecationWarning: executable_path has been deprecated, please pass in a Service object Error Here
executable_path
is deprecated you have to use an instance of theService()
class as follows. s = Service(‘C:/Users/…/chromedriver.exe’) and then driver = webdriver.Chrome(service=s) Now, Your error must be solved.
Solution 1: Just use an instance of the Service()
Here executable_path
is deprecated you have to use an instance of the Service()
class as follows.
from selenium import webdriver
PATH = './chromedriver.exe'
driver = webdriver.Chrome(PATH)
driver.get("https://www.google.com")
This will Give You deprecated warning So You Have to use an instance of the Service()
class instead of executable_path
just like This.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service('C:/Users/.../chromedriver.exe')
driver = webdriver.Chrome(service=s)
Now, Your error must be solved.
Solution 2: Use this code
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
ser = Service("C:\\chromedriver.exe")
op = webdriver.ChromeOptions()
s = webdriver.Chrome(service=ser, options=op)
Solution 3: Before and after
Before
from selenium import webdriver
chrome_driver_path = 'C:/Users/ssc/ChromeDriver/chromedriver.exe'
driver = webdriver.Chrome(executable_path=chrome_driver_path)
url = "https://www.google.com"
driver.get(url)
After
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s=Service('C:/Users/ssc/ChromeDriver/chromedriver.exe')
browser = webdriver.Chrome(service=s)
url='https://www.google.com'
browser.get(url)
Summary
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read
Thank You, this was of great help.
Thank you for such a clear explanation. My code was still running but I wanted to solve the deprecation error and had spent a lot of time doing so.
Very Grateful!
Thank you very much friend, you helped me with the problem
My pleasure to help You Andrew Carlos