Python OSError:[Errno 8]尝试使用browsermobproxy启动服务器时出现Exec格式错误
从中获取上述代码 我正在尝试使用BrosWebProxy和selenium导出HAR文件 软件规格: 操作系统:Ubuntu 16.04 脚本语言:Python(2.7.8) 自动Web浏览器:Selenium(3.5.0) BrowserMob代理:0.8.0和2.1.4(分别从pip和安装) 我试着添加shebang行,但没用。不知道我为什么会出错。任何帮助都将不胜感激。谢谢 您是否尝试添加#/bin/sh到文件的开头Python OSError:[Errno 8]尝试使用browsermobproxy启动服务器时出现Exec格式错误,python,selenium,selenium-chromedriver,browsermob,browsermob-proxy,Python,Selenium,Selenium Chromedriver,Browsermob,Browsermob Proxy,从中获取上述代码 我正在尝试使用BrosWebProxy和selenium导出HAR文件 软件规格: 操作系统:Ubuntu 16.04 脚本语言:Python(2.7.8) 自动Web浏览器:Selenium(3.5.0) BrowserMob代理:0.8.0和2.1.4(分别从pip和安装) 我试着添加shebang行,但没用。不知道我为什么会出错。任何帮助都将不胜感激。谢谢 您是否尝试添加#/bin/sh到文件的开头 from browsermobproxy import Server s
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()