Sometimes, we want to fix DeprecationWarning: executable_path has been deprecated with Selenium Python.
In this article, we’ll look at how to fix DeprecationWarning: executable_path has been deprecated with Selenium Python.
How to fix DeprecationWarning: executable_path has been deprecated with Selenium Python?
To fix DeprecationWarning: executable_path has been deprecated with Selenium Python, we upgrade selenium
to version 4.
Then we add the webdriver_manager
package.
To do both, we run
pip3 install -U selenium
pip3 install webdriver_manager
Then we update the code by writing
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.example.com")
to create the driver
with
webdriver.Chrome(service=Service(ChromeDriverManager().install()))
Then we call get
to open the page at the given URL.
Conclusion
To fix DeprecationWarning: executable_path has been deprecated with Selenium Python, we upgrade selenium
to version 4.
Then we add the webdriver_manager
package.