FirefoxDriver not honoring proxy settings

28 views
Skip to first unread message

Donald Raikes

unread,
Jun 5, 2018, 10:43:58 PM6/5/18
to seleniu...@googlegroups.com
Hello,
I am using selenium 3.12 with python 2.7.5 on oraclelinux 7.4 with firefox 52.0.

When I configure my wbdriver using the following code, I expect that
all traffic I run through selenium will be sent to my proxy, but after
running a variety of tests, when I check the proxy no traffic has been
received although all the browser tests have completed successfully.

Code to configure my webdriver is as follows:
import logging
import os
import sys
from time import sleep

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

def FirefoxWithProxy():
""" Return the selenium Firefox webdriver configured to use
127.0.0.1:8090 as a proxy. """
logging.info("Configuring FirefoxDriver with 127.0.0.1:8090 as a proxy")
proxyHost="127.0.0.1"
proxyPort="8090"
myProfile = "/home/draikes/secauto/profile"
profile = webdriver.FirefoxProfile(myProfile)
profile.set_preference("network.proxy.type", 1) # manual proxy
profile.set_preference("network.proxy.http", proxyHost)
profile.set_preference("network.proxy.http_port", proxyPort)
profile.set_preference("network.proxy.ssl", proxyHost)
profile.set_preference("network.proxy.ssl_port", proxyPort)
profile.set_preference("general.useragent.override","Mozilla/5.0
(X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0")
profile.update_preferences()
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
driver=webdriver.Firefox(firefox_profile=profile,capabilities=cap)
return driver

driver=FirefoxWithProxy()
driver.get("http://example.com")
...
driver.quit()

The proxy is OWASP Zed Attack Proxy (zap) which I am using for
security testing my web application.

any help would be appreciated.

Thanks,
Don
Reply all
Reply to author
Forward
0 new messages