firebug / har-export-trigger

Trigger HAR export any time directly from within a page.
Other
52 stars 13 forks source link

Page without HAR available #19

Open Jorge2M opened 8 years ago

Jorge2M commented 8 years ago

Hi, great work with those utilites for HAR manipulation.

I only have a problem with this plugin in a page concrete, these: https://shop.mango.com/checkout/paso1CheckoutPc.faces

In this page (and only in this page) the HAR is not available and I get a "Referece Error: HAR is not defined" when execute "HAR.triggerExport(options)" sentence.

The complete code JavaScript:: jsExec.executeScript( "var options = {" + "token: \"" + Constantes.TOKEN_HAR + "\"," + "getData: true," + "jsonp: true," + "fileName: \"" + nombreHAR +"\"" + "}; " + "HAR.triggerExport(options);");

And the preferences configured: fp.setPreference("extensions.netmonitor.har.enableAutomation", true); fp.setPreference("extensions.netmonitor.har.contentAPIToken", Constantes.TOKEN_HAR); fp.setPreference("extensions.netmonitor.har.autoConnect", true); fp.setPreference("devtools.netmonitor.har.defaultLogDir", FGenericas.getPathMethod(context, method)); fp.setPreference("devtools.netmonitor.har.pageLoadedTimeout", 1500); //Sólo tiene sentido para el save automático fp.setPreference("devtools.netmonitor.har.enableAutoExportToFile", false); fp.setPreference("devtools.netmonitor.har.includeResponseBodies", false); fp.setPreference("devtools.toolbox.footer.height", 1); //Establecemos al mínimo el tamaño del panel devtools

I use harexporttrigger-0.5.0-beta.7.xpi plugin.

Regards

Jorge2M commented 8 years ago

I have detected many others pages with the same problem, for example: http://www.mangooutlet.com/ES/mujer/prendas

soulgalore commented 8 years ago

@Jorge2M you should add an event listener that waits for har-api-ready, checkout the comment here:

https://github.com/firebug/har-export-trigger/issues/13#issuecomment-160660173

Jorge2M commented 8 years ago

I tested the @soulgalore solution but in my case the har-api-ready event don't start and the HAR object isn't never available even if I wait for minutes

I tested it from my webdriver code and directly with a standar Firefox44 installation + HAR trigger export plugin with the page http://www.mangooutlet.com/ES/mujer/prendas and I obtain the same KO result

soulgalore commented 8 years ago

hmm ok. I tested http://www.mangooutlet.com/ES/mujer/prendas in coming Browsertime 1.0 (using the HAR export trigger) (https://github.com/tobli/browsertime/tree/1.0) running it like this: bin/bt.js --experimental.nativeHar -b firefox http://www.mangooutlet.com/ES/mujer/prendas and that HAR file looked ok.

Jorge2M commented 8 years ago

@soulgalone, sorry, you're right, the first time I insert directly the URL http://www.mangooutlet.com/ES/mujer/prendas in the browser then the HAR object is available. But then, if I click a link or I push F5 then the HAR is not available..

For example: 1) Insert http://www.mangooutlet.com/ES/mujer/prendas in the browser -> HAR is available 2) Click link "Mujer" -> HAR is not available

or

1) Insert http://www.mangooutlet.com/ES/mujer/prendas in the browser -> HAR is available 2) F5 for refresh -> HAR is not available

Jorge2M commented 8 years ago

I have analized more the problem and i can view in what situation this appears. The HAR object is not available when the net traffic contains http and https connectiosns. That is, when firefox show the message "The connection used to fetch this resource was not secure" in some petition of the traffic.

brewt commented 8 years ago

I've run into this as well. Here are three more test cases:

I thought it might be something on the page redefining the HAR object, but that doesn't seem to be the case. Haven't had time to dig into it though.

Jorge2M commented 8 years ago

Hi @brewt,

I tested these 3 URLs and runs Ok too for me.

I suspect than in the case of navigation in http://www.mangooutlet.com/ES/mujer/prendas the problem is the many XHR post petitions against https://mc.yandex.ru/...

Regards