我正在尝试收集网络流量数据,在将其与我们的测试框架集成之前,我已经设置了一个概念验证。我可以得到 har 数据,它作为字典回来了,不知道之后该怎么处理它?我假设我需要将其写入文件以便上传,但我是将其保存为 .har 还是 .json?
server = Server("C:\\Users\\E003048\\Downloads\\browsermob-proxy-2.0-beta-9\\bin\\browsermob-proxy.bat")
server.start()
proxy = server.create_proxy()
profile = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)
proxy.new_har("Network Traffic")
driver.get("http://URL GOES HERE")
har_information = proxy.har
target_file = open("har_file.har", 'a')
target_file.write(str(har_information))
sleep(10)
proxy.close()
server.stop()
driver.quit()
我在脚本中添加了它写入 har 文件的位置,但是当我将其插入 har 查看器时:http: //www.softwareishard.com/har/viewer/我什么也没得到。还需要做什么?