FirefoxDriver not honoring proxy settings

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FirefoxDriver not honoring proxy settings

Donald Raikes
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

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAPamLv9Cgse09fbOThBG%2BrKpyBn5S1ZJu_r4odJFD2GQdzN-uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.