0

Got the following error when I tried to run this script:

from browsermobproxy import Server
server = Server("path/to/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.uk")
proxy.har # returns a HAR JSON blob

server.stop()
driver.quit()

Took the above code from https://browsermob-proxy-py.readthedocs.io/en/stable/index.html

I'm trying to export HAR files using broswermobproxy and selenium.

Software Specs:

OS: Ubuntu 16.04 Script Language: Python (2.7.8) Automated Web Browser: Selenium (3.5.0) BrowserMob-Proxy: 0.8.0 and 2.1.4 (Installed from pip and https://bmp.lightbody.net/ respectively)

I tried adding the shebang line but it didn't help. Not sure why I'm getting the error. Any help will be appreciated. Thanks.

shahnaz shariff
  • 130
  • 1
  • 3
  • 14

1 Answers1

1

Did you try adding #!/bin/sh to the start of your file ?

Doctor
  • 3,826
  • 2
  • 24
  • 44