Changing Proxy Settings without Closing the Driver in Selenium/Splinter Changing Proxy Settings without Closing the Driver in Selenium/Splinter selenium selenium

Changing Proxy Settings without Closing the Driver in Selenium/Splinter


You need to use it like below

browser.visit("about:config")script = """var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);prefs.setIntPref("network.proxy.type", 1);prefs.setCharPref("network.proxy.http", "{0}");prefs.setIntPref("network.proxy.http_port", "{1}");prefs.setCharPref("network.proxy.ssl", "{0}");prefs.setIntPref("network.proxy.ssl_port", "{1}");prefs.setCharPref("network.proxy.ftp", "{0}");prefs.setIntPref("network.proxy.ftp_port", "{1}");"""browser.execute_script(script.format("ProxyIP", "PORT"))

PS: Credits to Python Selenium Webdriver - Changing proxy settings on the fly