Is there a way to save a har file for the entire session using the inbuilt firefox netmonitor devtools

1,465 views
Skip to first unread message

Arjun Talwar

unread,
May 3, 2016, 10:25:55 AM5/3/16
to Firebug
hey All,

I am using firefox 43 with Selenium 2.51 and trying to run selenium webdriver tests and capture the har data using the inbuilt netmonitor options in firefox.
i am using the following firefox profile -
  profile.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE, localHostAlias);
        
        
        profile.setPreference("devtools.netmonitor.enabled", true);
        profile.setPreference("devtools.netmonitor.har.compress", false);
        profile.setPreference("devtools.netmonitor.har.defaultFileName", "HarOutputExport_%y%m%d_%H%M%S");
        profile.setPreference("devtools.netmonitor.har.defaultLogDir", "D:\\SeleniumInstrumentationJars\\HarOutputDir");
        profile.setPreference("devtools.netmonitor.har.enableAutoExportToFile", true);
        profile.setPreference("devtools.netmonitor.har.forceExport", true);
        profile.setPreference("devtools.netmonitor.har.includeResponseBodies", true);
        profile.setPreference("devtools.netmonitor.har.jsonp", false);
        profile.setPreference("devtools.netmonitor.har.jsonpCallback", false);
        profile.setPreference("devtools.netmonitor.har.pageLoadedTimeout", "2500");
        profile.setPreference("extensions.netmonitor.har.enableAutomation", true);
        profile.setPreference("extensions.netmonitor.har.contentAPIToken", "test");
        profile.setPreference("extensions.netmonitor.har.autoConnect", true);

I use the har export trigger extension to save the har file.

However, i am getting a multiple har files - one for each page navigated.... is there a way to generate only 1 har file with data pertaining to all the pages ?

Earlier I was using firebug + netexport plugins but they are too inconsistent with the data they generate, so ive stopped using those.

Please help..

Jan Honza Odvarko

unread,
May 3, 2016, 10:33:48 AM5/3/16
to Firebug

Arjun Talwar

unread,
May 4, 2016, 1:51:14 AM5/4/16
to Firebug
Thanks for replying Honza. 
Yes, like i mentioned above, I have used har export trigger to save the har files.
For that I am using the following preferences -

        profile.setPreference("extensions.netmonitor.har.enableAutomation", true);
        profile.setPreference("extensions.netmonitor.har.contentAPIToken", "test");
        profile.setPreference("extensions.netmonitor.har.autoConnect", true);

but i get a different HAR file for each page navigated instead of just one cummulative HAR file.

Is there a way to persist the entire sessions data into a single HAR file ?

Arjun Talwar

unread,
May 6, 2016, 2:18:07 AM5/6/16
to Firebug
Hey Honza,

Did you get a chance to take a look at the issue ?

Siva Kesava

unread,
Oct 4, 2016, 5:01:41 AM10/4/16
to Firebug
Can anyone help me regarding how to do the same thing for google chrome . I want to set preferences in a similar way to Chrome.

Balaji Nagisetty

unread,
Dec 18, 2016, 1:12:12 PM12/18/16
to Firebug
If data is loaded without  page reload? or How to trigger after some pagination?
Reply all
Reply to author
Forward
0 new messages