Skip to content Skip to sidebar Skip to footer

Python Selenium 4 - Firefox Firefoxbinary() Deprecated

I have upgraded to Selenium 4 new_binary_path = FirefoxBinary('path_to_binary') selenium.webdriver.Firefox(executable_path=path, options=ops, firefox_binary=new_binary_path) or op

Solution 1:

I have solved the issue

from selenium.webdriver.firefox.options import Options as options
from selenium.webdriver.firefox.service import Service

#///////////////// Init binary & driver
new_driver_path = 'path to driver'
new_binary_path = 'path to binary'

ops = options()
ops.binary_location = new_binary_path
serv = Service(new_driver_path)
browser1 = selenium.webdriver.Firefox(service=serv, options=ops)

Solution 2:

After installing the new version I encountered this problem and solved it as follows. I hope it helps to other friends.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options as options
from selenium.webdriver.firefox.options import Options as Firefox_Options

firefox_options = Firefox_Options()
firefox_options.binary = r'C:\Program Files\Mozilla Firefox\firefox.exe';

driver = webdriver.Firefox(executable_path=r'C:\\xampp\\htdocs\\dev\\geckodriver.exe',options=firefox_options)

driver.get('https://google.com')

Post a Comment for "Python Selenium 4 - Firefox Firefoxbinary() Deprecated"