DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object

We Are Going To Discuss About DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object. So lets Start this Python Article.

DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object

  1. How to solve DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object

    Here is the documentation for this:
    https://www.selenium.dev/documentation/webdriver/capabilities/driver_specific_capabilities/#setting-a-custom-profile
    I tried this locally and it worked:
    EDITED: I've changed the code, so there are no deprecation warnings
    from selenium.webdriver import Firefox from selenium.webdriver.firefox.service import Service from selenium.webdriver.firefox.options import Options profile_path = r'C:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\Profiles\y1uqp5mi.default' options=Options() options.set_preference('profile', profile_path) service = Service(r'C:\WebDriver\bin\geckodriver.exe') driver = Firefox(service=service, options=options) driver.get("https://selenium.dev") driver.quit()

  2. DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object

    Here is the documentation for this:
    https://www.selenium.dev/documentation/webdriver/capabilities/driver_specific_capabilities/#setting-a-custom-profile
    I tried this locally and it worked:
    EDITED: I've changed the code, so there are no deprecation warnings
    from selenium.webdriver import Firefox from selenium.webdriver.firefox.service import Service from selenium.webdriver.firefox.options import Options profile_path = r'C:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\Profiles\y1uqp5mi.default' options=Options() options.set_preference('profile', profile_path) service = Service(r'C:\WebDriver\bin\geckodriver.exe') driver = Firefox(service=service, options=options) driver.get("https://selenium.dev") driver.quit()

Solution 1

Here is the documentation for this:
https://www.selenium.dev/documentation/webdriver/capabilities/driver_specific_capabilities/#setting-a-custom-profile

I tried this locally and it worked:

EDITED: I’ve changed the code, so there are no deprecation warnings

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

profile_path = r'C:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\Profiles\y1uqp5mi.default'
options=Options()
options.set_preference('profile', profile_path)
service = Service(r'C:\WebDriver\bin\geckodriver.exe')

driver = Firefox(service=service, options=options)

driver.get("https://selenium.dev")

driver.quit()

Original Author Atanas Atanasov Of This Content

Solution 2

This error message…

firefox_profile has been deprecated, please pass in an Options object

…implies that FirefoxProfile() have been Deprecated and with to use a custom profile you have to use an instance of Options.


This DeprecationWarning was inline with the following CHANGELOGS:


All the configurations which was earlier set through profile.set_preference() now can be set through options.set_preference() as follows:

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

profile_path = r'C:\Users\Admin\AppData\Roaming\Mozilla\Firefox\Profiles\s8543x41.default-release'
options=Options()
options.set_preference('profile', profile_path)
options.set_preference('network.proxy.type', 1)
options.set_preference('network.proxy.socks', '127.0.0.1')
options.set_preference('network.proxy.socks_port', 9050)
options.set_preference('network.proxy.socks_remote_dns', False)
service = Service('C:\\BrowserDrivers\\geckodriver.exe')
driver = Firefox(service=service, options=options)
driver.get("https://www.google.com")
driver.quit()

tl; dr

Setting a custom profile

Original Author undetected Selenium Of This Content

Solution 3

I tried this

from selenium.webdriver.firefox.options import Options

profile_path = r'C:\Users\Administrator\AppData\Roaming\Mozilla\Firefox\Profiles\y1uqp5mi.default'
options=Options()
options.set_preference('profile', profile_path)
driver = Firefox(options=options)

Original Author shihar Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment