How does selenium change the proxy IP? without shutting down

you can also say this: change the IP, in the option and change the UA without shutting it down?

does not use crawler architecture, but directly uses python+selenium to write fixed-behavior crawlers. Now you need to integrate multithreading and IP proxy pool, and you don"t want new selenium to open a new browser.

Feb.07,2022

you can dynamically change IP by js injection
the following is the Python code of Firefox:

def change_ip (driver):

ip = get_ip()-sharpip"127.0.0.1:80"
driver.get("about:config");
-sharpjs
setupScript = '''var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setIntPref("network.proxy.type", 1);
prefs.setCharPref("network.proxy.http", "%s");
prefs.setIntPref("network.proxy.http_port", "%s");
prefs.setCharPref("network.proxy.ssl", "%s");
prefs.setIntPref("network.proxy.ssl_port", "%s");
prefs.setCharPref("network.proxy.ftp", "$%s");
prefs.setIntPref("network.proxy.ftp_port", "%s");
''' % (ip.split(':')[0], ip.split(':')[1], ip.split(':')[0], ip.split(':')[1], ip.split(':')[0], ip.split(':')[1])
-sharpjs
driver.execute_script(setupScript);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35726-2b710.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35726-2b710.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?