В общем, решил проблему, вот код:
class Driver:
options = webdriver.FirefoxOptions()
options.set_preference('dom.webdriver.enabled', False)
options.set_preference('media.volume_scale', '0.0')
options.set_preference('general.useragent.override', user_agent)
profile = webdriver.FirefoxProfile()
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.http', proxy["ip"])
profile.set_preference('network.proxy.http_port', proxy["http_port"])
profile.set_preference('network.proxy.https', proxy["ip"])
profile.set_preference('network.proxy.https_port', proxy["http_port"])
profile.set_preference('network.proxy.ssl', proxy["ip"])
profile.set_preference('network.proxy.ssl_port', proxy["http_port"])
profile.set_preference('network.proxy.ftp', proxy["ip"])
profile.set_preference('network.proxy.ftp_port', proxy["http_port"])
profile.set_preference('network.proxy.socks', proxy["ip"])
profile.set_preference('network.proxy.socks_port', proxy["socks_port"])
driver = webdriver.Firefox(firefox_profile=profile, options=options)
@classmethod
def change_proxy(cls):
cls.profile.set_preference('network.proxy.http', ip)
cls.profile.set_preference('network.proxy.http_port', port)
cls.profile.set_preference('network.proxy.https', ip)
cls.profile.set_preference('network.proxy.https_port', port)
cls.profile.set_preference('network.proxy.ssl', ip)
cls.profile.set_preference('network.proxy.ssl_port', port)
cls.profile.set_preference('network.proxy.ftp', ip)
cls.profile.set_preference('network.proxy.ftp_port', port)
cls.profile.set_preference('network.proxy.socks', ip)
cls.profile.set_preference('network.proxy.socks_port', socks_port)
cls.profile.update_preferences()
cls.driver.quit()
cls.driver = webdriver.Firefox(firefox_profile=cls.profile, options=cls.options)
cls.driver.get("https://2ip.ru/")