0

I am using Firefox add-on HAR export trigger for test automation with Robotframework/Selenium. The test basically navigates to a web page and greps the exported har files for some expression. The test sometimes fails.

In those cases, I noticed that there are far less requests (about 20) in the har file than on the network tab of the browser window used by the test case (about 70). If I export those requests manually after the test case has stopped, all requests are exported as expected.

So I guess, something is interrupting the export function (although no other page is opened and the browser is not closed). I could use a dumb Sleep but is there a smarter way for the test client to check if exporting is still in progress? Some JS call maybe or a callback?

I tried to wait for a specific number of export files to exist, but that does not work reliably.

I've seen a parameter like devtools.netmonitor.har.jsonpCallback but don't how to use it. My settings are

("devtools.netmonitor.enabled", true);
("devtools.netmonitor.har.compress", false);
("devtools.netmonitor.har.defaultFileName", "Autoexport_%y%m%d_%H%M%S");
("devtools.netmonitor.har.defaultLogDir", <somepath>);
("devtools.netmonitor.har.enableAutoExportToFile", true);
("devtools.netmonitor.har.forceExport", true);   
("devtools.netmonitor.har.includeResponseBodies", false);
("devtools.netmonitor.har.jsonp", false);
("devtools.netmonitor.har.jsonpCallback", false);
("devtools.netmonitor.har.pageLoadedTimeout", "2500");

Versions:

Firefox 43.0, 
Python 2.7.8, 
selenium 2.48.0, 
robotframework 3.0, 
robotframework-selenium2library 1.7.4, 
harexporttrigger-0.5.0-beta.7
Würgspaß
  • 4,660
  • 2
  • 25
  • 41

1 Answers1

0

Not really a solution but a workaround: Autoexport is switched off, export is triggered programmatically as described here.

I wasn't aware of that, before. But now I think this is a far better approach because it is

  • more stable
  • performs better
  • allows more control

Settings:

devtools.netmonitor.har.enableAutoExportToFile, false
devtools.netmonitor.har.forceExport, false
extensions.netmonitor.har.enableAutomation, true
extensions.netmonitor.har.contentAPIToken, "test"
Würgspaß
  • 4,660
  • 2
  • 25
  • 41