I'm trying to automate page load time testing. I'm imagining running a cron job every couple hours that will load various pages from my website, retrieve the associated har files, and process the data. The part I can't figure out is how to programatically generate har files ... the only way I know of now is manually through chrome developer tools. Does anyone know if this can be done, and if so how?
Have a look at the BrowserMob Proxy or run a private instance of WebPageTest and use WPT Monitor with it
We just did this recently with Firebug and NetExport:
http://www.softwareishard.com/blog/netexport/
You can configure NetExport to automatically export HAR files to a specified directory (compression optional). This has been useful for us in getting samples of resource loading data for particular web apps.
Have a look at the BrowserMob Proxy or run a private instance of WebPageTest and use WPT Monitor with it
PhantomJS (headless Webkit-browser on Node.js) can export .har files directly.
This way you should be able to build a tool that returns a .har-file for a given URL...
Using the combination of Selenium Server, Browsermob-Proxy and Chromedriver (if you wish to use Chrome to do your tests) in a language binding of your choice (java, python, c#) is the best way to programatically generate an HAR file, imho.
I have written this little python tool that uses Browsermob proxy to generate HAR file headlessly using Chrome or Firefox. It also generates NavigationTimingAPI data that lets you get to the tiny details of page load time.
If you can't run your own instance as Mr. Davies suggested you could use the REST API.
Marcel Duran has written a WebPageTest API wrapper for nodejs. Which can return a HAR from the resulting test. https://github.com/marcelduran/webpagetest-api
Har file reader API also available which will help you to parse the har file basically JSON format .
You can also get the details of each http/https request/response,etc for preparing metrics.
© 2022 - 2024 — McMap. All rights reserved.