0

Got the following error when I tried to run this script: OSERROR:[错误8]尝试使用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() 

启动服务器时Exec的格式错误从https://browsermob-proxy-py.readthedocs.io/en/stable/index.html

我试图用出口和broswermobproxy硒HAR文件拍摄了上面的代码。

软件规格:

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

我尝试添加shebang行但它没有帮助。不知道为什么我得到错误。任何帮助将不胜感激。谢谢。

回答

0

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