Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix "TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'" #136

Open
kptung opened this issue Apr 2, 2024 · 0 comments

Comments

@kptung
Copy link

kptung commented Apr 2, 2024

after selenium 4.6.0,it removed the executable_path in its parameter configuration.
If you want to pass in an executable_path, you'll have to use the service arg now.

//////////////
from selenium import webdriver
from selenium.webdriver.firefox.service import Service

service = Service(executable_path="PATH_TO_GECKODRIVER")
options = webdriver.FirefoxOptions()
driver = webdriver.Firefox(service=service, options=options)
driver.quit()
//////////////
But you no longer need to specify an executable_path due to a fully operational Selenium Manager in 4.10.0, so this is all you need:
//////////////
from selenium import webdriver
from selenium.webdriver.firefox.service import Service

service = Service()
options = webdriver.FirefoxOptions()
driver = webdriver.Firefox(service=service, options=options)
driver.quit()
//////////////
or
//////////////
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)
//////////////

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant