OSError: [Errno 8] Exec format error when trying to start server using browsermobproxy

1k views Asked by At

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.

1

There are 1 answers

0
Doctor On

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