OSError:[Errno 8]尝试使用browsermobproxy启动服务器时出现Exec格式错误

2024-04-30 05:04:22 发布

您现在位置:Python中文网/ 问答频道 /正文

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()

https://browsermob-proxy-py.readthedocs.io/en/stable/index.html获取上述代码

我尝试使用broswermobproxy和selenium导出HAR文件。在

软件规格:

操作系统:Ubuntu 16.04 脚本语言:Python(2.7.8) 自动Web浏览器:Selenium(3.5.0) BrowserMob代理:0.8.0和2.1.4(分别从pip和https://bmp.lightbody.net/安装)

我试着添加shebang行,但没用。不知道我为什么会出错。任何帮助都将不胜感激。谢谢。在


Tags: fromhttpsimportserverdriverseleniumgoogleprofile