Home > OS >  Selenium 4 webdriver_manager: executable_path is deprecated. How to use for Firefox?
Selenium 4 webdriver_manager: executable_path is deprecated. How to use for Firefox?

Time:11-01

I'm moving my test project from Selenium 3 to Selenium 4 and I'm getting warnings about "executable_path" deprecation. I couldn't find the proper way to use webdriver_manager for Firefox with Selenium 4 so I'm still using the "executable_path". They also haven't updated their doc here: https://pypi.org/project/webdriver-manager/

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager

driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())

Does anyone have the solution for this case?

CodePudding user response:

Try this

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
driver = webdriver.Firefox(GeckoDriverManager().install())

CodePudding user response:

Ok, I fixed the issue thanks to this video: https://www.youtube.com/watch?v=VMzmVFA-Gps

The correct usage should be:

from selenium.webdriver.firefox.service import Service

@staticmethod
def get_local_firefox_driver(options):
    service = Service(GeckoDriverManager().install())
    driver = Firefox(
        service=service,
        options=options,
    )
  • Related