Detailed procedure for creating a har file from a given URL using the command line tool

Can anyone advise how to generate har file from given url via command line in Linux? Detailed tools used and guidelines are greatly appreciated.

thank

+5
source share
3 answers

You can use phantomjs for this work.

phantomjs examples/netsniff.js "some_url" > out.har 

or look at BrowserMob Proxy

+5
source

PhantomJS HAR, , HAR, , Chrome, Firefox. BrowsermobProxy, HAR python script, :

from browsermobproxy import Server
from selenium import webdriver
import json

server = Server("path/to/browsermob-proxy")
server.start()
proxy = server.create_proxy()
profile = webdriver.FirefoxProfile()
profile.set_proxy(self.proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)
proxy.new_har("http://stackoverflow.com", options={'captureHeaders': True})
driver.get("http://stackoverflow.com")    
result = json.dumps(proxy.har, ensure_ascii=False)
print result
proxy.stop()    
driver.quit()

, HAR Chrome Firefox, Speedprofile.

+2

Phantomjs har . , - Chrome .

phantomjs -, .

( har)

, netsniff.js.

. , 20 , . , js. phantomjs, har, . ( , /)

, . , phantomjs.

25.

https://github.com/associatedpress/phantomjs/blob/netsniff-timer/examples/netsniff.js

+1

All Articles