Python + browsermob-proxy

522 views
Skip to first unread message

Darcy Westfall

unread,
Jun 21, 2012, 2:11:59 PM6/21/12
to browserm...@googlegroups.com
Hello, I'm new to Python and I'm trying to use Python with Browsermob-proxy.  I've taken the example code from  http://oss.theautomatedtester.co.uk/browsermob-proxy-py/ 

from browsermobproxy import Server

server = Server("/home/browsermob/browsermob/bin/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.com")
proxy.har # returns a HAR JSON blob

server.stop()
driver.quit()

When I run this, I get the following error:

Traceback (most recent call last):
  File "webtest.py", line 10, in <module>
    profile.set_proxy(proxy.selenium_proxy())
AttributeError: 'function' object has no attribute 'selenium_proxy'

The environment is CentOS 6.2 with system Python (2.6.6) 

I've googled around but can't seem to find the answer to this..can someone point me in the right direction?

Thanks,

Darcy

Luke Inman-Semerau

unread,
Jun 21, 2012, 2:33:35 PM6/21/12
to browserm...@googlegroups.com
the third line should be:

proxy = server.create_proxy()

Darcy Westfall

unread,
Jun 21, 2012, 2:44:14 PM6/21/12
to browserm...@googlegroups.com
Thanks!, that worked.
Reply all
Reply to author
Forward
0 new messages