Running on a mac I am trying to use browsermob-proxy
to monitor connections during python-selenium tests. I downloaded the java implementation 2.1.4 from here and pip installed the python wrapper ( browsermobproxy
). The full example code is here (following examples found a lot):
from browsermobproxy import Server
server = Server("/Users/adietz/Projects/Invest/browsermob/browsermob-proxy-2.1.4/browsermob-dist/src/main/scripts/browsermob-proxy")
server.start()
proxy = server.create_proxy()
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)
proxy.new_har("google")
driver.get("http://www.google.co.in")
proxy.har
server.stop()
driver.quit()
But when running this code with python 3.6.2 gives the following error:
Traceback (most recent call last):
File "tester1.py", line 3, in <module>
server.start()
File "/Users/adietz/Projects/Invest/browsermob/browsermob/lib/python3.6/site-packages/browsermobproxy/server.py", line 127, in start
raise ProxyServerError("Can't connect to Browsermob-Proxy")
Is there a way to fix this error and be able to use browsermob-proxy
on a mac?