Skip to content Skip to sidebar Skip to footer

How To Set Proxies Like This "user:pass@6.6.6.6:8043" In FirefoxDriver Of Selenium 2?

This is an example from selenium docs: from selenium import webdriver PROXY_HOST = 'host' PROXY_PORT = 8080 fp = webdriver.FirefoxProfile() # Direct = 0, Manual = 1, PAC = 2, AU

Solution 1:

I don't know of a way to pass a username and password like that. How I would handle it is use webdriver to catch the popup and the send_keys() to that popup same as you would on a regular page.


Solution 2:

I am not much into python, but I believe, that if you update these two values to:

PROXY_HOST = "user:pass@6.6.6.6"
PROXY_PORT = 8043

It should work.

BTW, on the same topic: I am also sitting behind the proxy and had never to set up proxy configuration in my firefox WebDriver.

I am using java, so it can be either the java WebDriver, or just the fact that I was accessing only the sites behind the proxy...

EDIT

try adding this into your profile. Hope it helps:

fp.setPreference("browser.safebrowsing.malware.enabled", false);

above setting allows sending username and password in URL


Solution 3:

After playing with Selenium for quite a while I came to realization that it's not designed for working with proxies, and it's definitely a pain in the ass If you are trying to make it work like what I did in the past. I eventually turned to tools like requests for most of my proxy related job.


Post a Comment for "How To Set Proxies Like This "user:pass@6.6.6.6:8043" In FirefoxDriver Of Selenium 2?"