selenium proxy authentitcation (python and firefox)

slippery_slider

Regular Member
Joined
Dec 28, 2021
Messages
252
Reaction score
202
Hi. I'm having a problem where i cant authenticate proxy with selenium no matter what I try. I've seen a few solutions, but all of them are GUI automation. Does anyone of you know how to do it?
 
What language? What type of proxy? Here is example with python

from selenium import webdriver
PROXY = "11.456.448.110:8080"
chrome_options = WebDriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("https://www.google.com")

another example

from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy, ProxyType

prox = Proxy()
prox.proxy_type = ProxyType.MANUAL
prox.http_proxy = "ip_addr:port"
prox.socks_proxy = "ip_addr:port"
prox.ssl_proxy = "ip_addr:port"

capabilities = webdriver.DesiredCapabilities.CHROME
prox.add_to_capabilities(capabilities)

driver = webdriver.Chrome(desired_capabilities=capabilities)

there are many examples onlinr
 
Is IP whitelisting an option? It's the least painful in my experience.
 
Is IP whitelisting an option? It's the least painful in my experience.
Most probably this.


Make sure you add the server ip where selenium is running, to your proxy provider’s whitelist. Otherwise, the proxies won’t connect atall (for some providers, not even with user/pass).


What provider are you using btw? In my experience, some providers only support the whitelisting option. Tried their user/pass auth which didn’t work for me as well.
 
Is IP whitelisting an option? It's the least painful in my experience.
Yes, though I have a dynamic IP.
Most probably this.


Make sure you add the server ip where selenium is running, to your proxy provider’s whitelist. Otherwise, the proxies won’t connect atall (for some providers, not even with user/pass).


What provider are you using btw? In my experience, some providers only support the whitelisting option. Tried their user/pass auth which didn’t work for me as well.
I gave up and switched to playwright, which authenticates without any problems, also seems to be faster and more lightweight.
 
Back
Top