How to install 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, AUTODETECT = 4, SYSTEM = 5
fp.set_preference("network.proxy.type", 1)

fp.set_preference("network.proxy.http", PROXY_HOST)
fp.set_preference("network.proxy.http_port", PROXY_PORT)
fp.set_preference("network.proxy.ftp", PROXY_HOST)
fp.set_preference("network.proxy.ftp_port", PROXY_PORT)
fp.set_preference("network.proxy.ssl", PROXY_HOST)
fp.set_preference("network.proxy.ssl_port", PROXY_PORT)

fp.set_preference("network.proxy.no_proxies_on", "") # set this value as desired

driver = webdriver.Firefox(firefox_profile=fp)

Well, if I want to install a private proxy server, for example "user:pass@6.6.6.6:8043"?

And one more question: how can I catch http exceptions like 404, 403, 502, etc.?

0
source share
3 answers

I do not know how to pass the username and password. How would I deal with this is to use webdriver to catch popup and send_keys () for this popup as well as on a regular page.

+1
source

python, , :

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

.

BTW, : - - firefox WebDriver.

java, Java WebDriver, , -...

EDIT

. , :

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

URL

0

Selenium , -, . , , . , requests .

0

All Articles