stack_queries
stack_queries

Reputation: 11

How to replay server response from .har file?

I am new to this, this is my first question here. Please guide me to improve.

Learning python automation. Came across scenario to automate "replay server response from .har file".

Could capture, HAR file

from browsermobproxy import Server

server = Server("~/browsermob-proxy")

server.start()
proxy = server.create_proxy()

from selenium import webdriver
co = webdriver.ChromeOptions()
co.add_argument('--proxy-server={host}:{port}'.format(host='localhost', port=proxy.port))

driver = webdriver.Chrome(executable_path = "~/chromedriver", chrome_options=co)

proxy.new_har
driver.get(url)
proxy.har

How can I replay server response from captured HAR file (offline) ? Is it possible with python or any other ? And what's the significance of replay server response ?

Could you please help me ?

Upvotes: 1

Views: 953

Answers (1)

Daniel Prol
Daniel Prol

Reputation: 114

Check out this https://github.com/louisabraham/har2requests. It should convert the .har file into a python script.

Upvotes: 0

Related Questions