I searched a lot, this came up many times over the past decade, but nothing addressing the problem or with the latest version of Selenium + Python (that I can find)
If I set up a socks5 proxy server (using Ubuntu 22.04 and Dante), I can forward my requests through it using Selenium 4 and Firefox Options like so:
options = webdriver.FirefoxOptions()
PROXYaddr = 'XXX.XXX.XXX.XXX:YYYY'
PROXY_IP, PROXY_PORT = PROXYaddr.split(':')
options.set_preference('network.proxy.type', 1)
options.set_preference('network.proxy.socks', PROXY_IP)
options.set_preference('network.proxy.socks_port', int(PROXY_PORT))
driver = webdriver.Firefox(options=options)
Now this works. The problem comes in if the socks5 proxy requires a username and password authentication.
How can I add username and password auth for this socks5 proxy in Selenium 4 with Firefox?
I am looking for a solution that does not require installing extra extensions, or working with a UI as this code runs in headless mode on a server.
Thank you