简体   繁体   中英

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

当我尝试运行此脚本时出现以下错误:

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.

您是否尝试将#!/ bin / sh添加到文件的开头?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM