Giter VIP home page Giter VIP logo

har-export-trigger's Introduction

Firebug

Web Development Evolved getfirebug.com

On November 14, with the launch of Firefox Quantum (AKA 57), support for old school extensions will stop in Firefox. That means Firebug will no longer work for many developers. However, the work continues in the great Firefox devtools. You can try Firefox devtools by updating your release browser or downloading Developer Edition. Read more here

Download

License

Firebug is free and open source software distributed under the BSD License.

Source Repository Structure

See more information about Firebug repository structure.

  • extension Firebug extension directory.
  • tests Firebug automated test files and test harness.
  • trace Firebug tracing console.

Build Firebug XPI

In order to build Firebug *.xpi package run following in your command line (you need Apache Ant)

$ cd firebug/extension
$ ant

The *.xpi file should be located within ./release directory.

Run Firebug From Source

The extension directory directly contains Firebug extension files and so, you can run Firebug directly from it. This is the recommended way how to quickly test your code changes and provide a patch.

  1. Locate your Firefox profile folder
  2. Open extensions/ folder, create if it doesn't exist.
  3. Create a new text file and put the full path to your development folder inside. (e.g. C:\firebug\extension\ or ~/firebug/extension/). Windows users should retain the OS' slash direction, and everyone should remember to include a closing slash and remove any trailing spaces.
  4. Save the file with Firebug ID as it's name [email protected]

Hacking on Firebug

See detailed instructions about how to provide a patch to Firebug source.

Further Resources

har-export-trigger's People

Contributors

csabakos avatar janodvarko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

har-export-trigger's Issues

How to trigger Har export on java project?

Hi!
Right now i have devtools.netmonitor.har.enableAutoExportToFile to true thus a new HAR file is created for every loaded page automatically but I am only interested on getting har file for specific http request or for a specific load page. I came across a script to trigger har export on javascript but how do we do it in java? Also I could not make the test page run : http://janodvarko.cz/har/tests/har-export-trigger/har-export-api.html
It simply gives ReferenceError: HAR is not defined . What am I missing?

Problem with extended characters in defaultLogDir

I have a problem when I init the devtools.netmonitor.har.defaultLogDir with a string with extended characters.

In my case the path is dinamic:
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);

When the value is for example "C:\scripts-library\test-output\Menus_PC\PAR001_Acceso_Pais_Idioma(España (Península y Baleares) (001) -Castellano)"

There is the directory tha is created:
C:\scripts-library\test-output-library\Menus_PC\Menus_PC\PAR001_Acceso_Pais_Idioma(España (Península y Baleares) (001) -Castellano)

HAR Export > Iframe Vimeo Video 'then' Property Permission Denied

I have a page that I am attempting to export the requests for. This page contains multiple videos(HTML5, Vimeo).

I have the API script, that is executed using Selenium, to export the HAR once all videos have finished playing.

har_script = "var options = {
      token: \"test\",
      fileName: \"#{file_name}\"
      };

      HAR.triggerExport(options).then(result => {

      });"

However when calling the above script after the Vimeo videos are playing I get the below error. This does not occur for the HTML5 videos.

Permission denied to access property "then" (Selenium::WebDriver::Error::JavascriptError)
[remote server] https:./player.vimeo.com/video/185300229 line 69 > Function:6:in anonymous' [remote server] https:./player.vimeo.com/video/185300229:69:in handleEvaluateEvent'

The Vimeo video is within an iframe, like so

<iframe src="https://player.vimeo.com/video/185300229" width="640" height="640" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/185300229">Monkey Swinging Shadow Puppet with coloured acetates on overhead projector</a> from <a href="https://vimeo.com/user977287">amy lloyd-jones</a> on <a href="https://vimeo.com">Vimeo</a>.</p>

Interestingly comparing the error output and the html source the link is malformed, https://player.vimeo.com/video/185300229 vs https:./player.vimeo.com/video/185300229
Don't know if that is a cause or not

Missing events in the har file after the page is loaded

I noticed that the HAR file is generated immediately on page load event completion. Imagine the following usecase -
I navigated to gmail. the moment the page load event completed the har file got generated.

Now i opened my mail, then the sent folder and then opened the trash folder.

All these events do not result in a page load event firing and hence dont not get captured anywhere in the har file (which is already written). (All of these are ajax calls i guess)

How do I get those events in the har file ?

Missing Post data

I'm using Selenium to export data by firing the following JavaScript on the browser:

var options = {
token: "test",
fileName: "my test har file %Y, %H:%M:%S" // Name of the file
};

HAR.triggerExport(options).then(result => {
// The local file is available now
});

The resulting HAR file is missing the Post data sent in a form. The same occurs when pasting the JavaScript into the console at the same point Selenium would trigger the export, regardless of whether the actions have been input manually or driven from the Selenium.

Example - exported using Javascript and har export api:

"postData": {
"mimeType": "application/x-www-form-urlencoded", "mimeType": "application/x-www-form-urlencoded",
"params": [ "params": [],

Example - exported by right-clicking on network pane and copy as har (username and password have been removed):

"postData": { "postData": {
"mimeType": "application/x-www-form-urlencoded", "mimeType": "application/x-www-form-urlencoded",
"params": [ "params": [],
{
"name": "QuickJump",
"value": ""
},
{
"name": "Login:LoginScreen:LoginDV:username",
"value": "<>"
},
{
"name": "Login:LoginScreen:LoginDV:password",
"value": "<>"
},
{
"name": "csrfToken",
"value": "cd9f6d030a754c893ff7ec8834226a9cb258ca9d"
},
{
"name": "eventSource",
"value": "Login:LoginScreen:LoginDV:submit_act"
},
{
"name": "objFocusId",
"value": "Login:LoginScreen:LoginDV:submit"
}
],

HAR includes requests from the local cache

If I access a page, and then do another access for the same URL, assets that are from the cache is in the HAR:

screen shot 2016-09-09 at 22 18 32

The first request has wrong response code (it should be a 304, it is a 200). The length of the timings are 0 if they are fetched from the cache. The cache field in the HAR is empty.

Do you know if this is something wrong in the trigger or is the problem in Firefox?

Missing pageTimings

Hello,

Second issue which I thought I should create separately, is regarding the data collected, the pages.pageTimings has the values

    "pages": [
      {
        "startedDateTime": "2015-09-15T23:49:33.457+03:00",
        "id": "page_10",
        "title": "my custom title",
        "pageTimings": {
          "onContentLoad": -1,
          "onLoad": -1
        }
      }

Was this a 'todo' thing or is there a meaning for this and I missed it?

Thank you.

Cannot get it to work with selenium with java

Hi

I don't know what I did wrong.
I am using firefox 42.0b9 with HAR Export Trigger 0.5.0-beta.6. Here is code I used.

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("devtools.netmonitor.har.enableAutoExportToFile", true);
profile.setPreference("devtools.netmonitor.har.pageLoadedTimeout", 10000);
profile.setPreference("app.update.enabled", false);
System.out.println("Profile directory:" + profile.layoutOnDisk() + ".");
String suggestedProfile = System.getProperty("webdriver.firefox.profile");
System.out.println("Profile name:" + suggestedProfile);
WebDriver driver = new FirefoxDriver(profile);
Thread.sleep(5000);
Actions action = new Actions(driver);
//Do I need this?
action.sendKeys(Keys.F12);
action.perform();
Thread.sleep(10000);
driver.get("http://google.com");
driver.quit();
Thread.sleep(100000);

But I don't see any har file in the profile directory. Am I doing something wrong?
Thanks!

Returning object from triggerExport

Hello Honza,

I was able to make this working in the end in my browser. I only had to restart the browser after installing har-export-trigger.

Anyway, the issue currently is that I want to return the har.log object back to selenium, I don't want to have lots of files created, rather, I want get the data, parse it and dump it. har-export-trigger is really the best I've tested so far and its really fast.

I'm currently lost at this step. If possible, please provide some pointers in which direction to go.

To explain the issue, as you know:
HAR.triggerExport(options);
this returns a promise, I played a bit with it but I can't figure out a way to get the har.log object outside that scope.

I guess it was not intended to be used like that? Is there any workaround?

Thank you again.

ReferenceError: HAR is not defined

I'm using HAR Export Trigger with Firefox 42 on Linux.

The scenario in which I get this error message:
I open firefox from commandline with an URL to my website on which the script to export the HAR data is run after a timeout of a few seconds.
If the netmonitor in firefox is not open while the export function is run, I get the error message "ReferenceError: HAR is not defined".
If I open the netmonitor manually before the export is run, everything is exported and the problem doesn't occur.
My problem is that firefox doesn't start the netmonitor automatically, but for my testing environment it is necessary that the export process runs automatically.

I'm not really sure if this is a problem that can't be fixed, because firefox can't export the data without an opened netmonitor, or if it is a problem with the har-export-trigger extension, so sorry if this is the wrong place to report this problem.

get Har Log as java object from selenium

Hi,

I am wondering if there is way to get the har log as a string or object using selenium in java? Currently I would have to read from the saved har file and read that in as a string. I know we can trigger the har export through java script, but I don't know how to get it in the java code...

Something like this?
driver.get("https://google.com");
if(driver instanceof JavascriptExecutor) {
((JavascriptExecutor) driver).executeScript(
" var options = { token: "mySpecialValue", getData: true, title: "Title for the HAR log", jsonp: false,};" +
"HAR.triggerExport(options).then(result => { var har = JSON.parse(result.data); console.log("HAR log: ", har.log);}, err => { console.error(err);});");
}

then, how do I get it in java code...
Thanks!

Wrong Title in the pages:title elem in the har file

for any page entry present in the har file, i always see the following -
"pages": [
{
"startedDateTime": "2016-05-04T14:56:25.225+05:30",
"id": "page_1",
"title": "New Tab",
"pageTimings": {
"onContentLoad": -1,
"onLoad": -1
}
}
],
The page title is always "New Tab". Why is the actual title not picked up ?
Also, pageTimings: onContentLoad and onLoad is always -1 but i assume there is a bug for that already.

how to install version 10

The latest add on version is 7, how can I install 10-unsigned version.
I got error from console, "HAR is not defined".

Promise for triggerExport is not coming back

Hey,
I'm using this HAR plugin among with firefox add-on that is related to it.

when activating triggerExport with two then functions (as success and failure) mixed with my code the promise are not going into the success nether the error function (like he enters pending status).

The strange thing that when I execute it in the console directly at any time it's performing well!!

What could happened?!

Question: Clarifying which Developer Toolbox you mean on the blog page

Hi;

On the page http://www.softwareishard.com/blog/har-export-trigger/ , it says:

Basic automated HAR export is already supported by Firefox 41+ and all the user needs to do is set devtools.netmonitor.har.enableAutoExportToFile preference to enable it. As soon as this pref is true, a new HAR file is created automatically for every loaded page and stored in /har/logs directory.

The developer Toolbox needs to be opened for this built-in feature to work.

Note that manual HAR export is also supported since Firefox 41. Just select the Network panel (make sure there are some collected data) and pick either Copy All As HAR (into the clipboard) or Save All As HAR (into a file).

I'm trying to get the native FF 43.0 har exporting to work, and have set devtools.netmonitor.har.enableAutoExportToFile to true, but the .../har/logs directory hasn't been created.

Can you give a link or description to which developer toolbox needs to be opened, or how to open it? If I search Google for it, it suggests "Developer Toolbar", which I've already got. I'm going a little batty trying to find this mysterious developer toolbox in the menus. The only network panel I can find is in Firebug, but that's not what you meant, as it's definitely open, but not logging. And the "Copy/Save All As HAR' option is not on the menu.

Anyhoo, thanks for listening to a newbie.

ReferenceError: HAR is not defined

Hi
First, thanks for this plugin, it will be a really helpful.

Trying to execute (follow the readme) I get this error ReferenceError: HAR is not defined and I can't figure out what is wrong.

Thanks again

HAR Export Trigger to work with single HTTP event & example page not working

Per previous issue report (firebug/netexport#21), I am attempting to extract a single HAR export to capture the traffic that results in a tracking pixel returning a query string parameter.

Previous to HAR Export Trigger, I had this setup sort-of working with latest (non-developer) Firefox, Firebug 2.0.12, and NetExport 0.9b7 (code for this in the link above). The two main issues being that:

  1. There would be 3 HAR exports: one for the initial page visit, one for logging into the site, and one for the product search that would result in the desire HAR export.
  2. The HAR files exported would have a naming convention default of "(url)(date/time).HAR", and with no real way to arbitrarily name the file. This was (is) preventing me from further automating my regression testing. The real benefit from the previous Firefox/Firebug/NetExport is that I did not need to insert any HTML or script within the pages I wanted to trigger a HAR export for. Unless I'm mistaken, I think that this is a requirement in order to properly use HAR Export Trigger, which is effectively leaving my dead in the water with my automated regression testing efforts.

Lastly, I cannot seem to get the HAR Export Trigger example page to work, even after enabling the API within Firefox. After clicking "Execute XHR", I see an event in the dev panel, but clicking "HAR Export" gives me the message saying that I have not enabled the API ("Security check didn't pass. You need to set 'devtools.netmonitor.har.contentAPIToken' pref to match the string token passed into HAR object API call (browser restart is required").

Thank you in advance for your time!

EDIT: Forgot to add that I also have the devtools.netmonitor.har.enableAutoExportToFile preference enabled as well.

Support external proxy

Hello,
I'm using har-export-trigger with Selenium, everything work well!
I'm not sure the extension supported external proxy or not but I tried

$profile->setPreference('extensions.netmonitor.har.contentAPIToken', $private_token);
$profile->setPreference('extensions.netmonitor.har.enableAutomation', true);
$profile->setPreference('extensions.netmonitor.har.autoConnect', true);
$profile->setPreference('devtools.netmonitor.har.defaultLogDir', '/tmp/');
$profile->setPreference('network.proxy.type', 1);
$profile->setPreference('network.proxy.http', $proxy_host);
$profile->setPreference('network.proxy.http_port', $proxy_port);
$profile->setPreference('network.proxy.ssl', $proxy_host);
$profile->setPreference('network.proxy.ssl_port', $proxy_port);

and I saw that Firefox did not connect to the proxy.

Incorrect body size in HAR

The content body size is reported incorrectly in certain cases. At least one of those cases is when the first call has a 302 response. HAR displays the body size of first 200 response as the body size for redirected response.

For example:

  • First call with a 302 redirect (actual response body size 0)
  • Second call with a 302 redirect (actual response body size 0)
  • Third call gets 200 response (actual response body size x bytes)
    HAR exported using har-export-trigger will show x bytes for all 3 calls.

This doesn't happen when the HAR is exported by right clicking on network panel.

HAR file not exported for some page using Selenium

Hello,
I'm using Selenium to automate HAR creation.
I've a very simple setup (available at https://github.com/marty90/WebTrafficGenerator):

  1. Selenium requests the page
  2. A simple Javascript is executed to invoke HAR.triggerExport function.
    Everything works except for some web page.
    Sometimes the invocation to triggerExport ()is ineffective and no HAR file is created.
    It seems to appear more frequently for some website (e.g., YouTube homepage).
    Does anybody know a workaround for this?

HAR is not defined

Hi,
I feel like this has been answered several times already, but none of the threads I looked at solved my issue.

I'm running Firefox 53.0.2 on OSX and have the HAR Export Trigger 0.5.0-beta.7 add-on installed.

The following Firefox settings are set:

devtools.netmonitor.har.enableAutoExportToFile => true
extensions.netmonitor.har.contentAPIToken => test
extensions.netmonitor.har.enableAutomation => true
extensions.netmonitor.har.autoConnect => true

The result is I'm not able to see the HAR object, and get the "ReferenceError: HAR is not defined" message in console.

I've tried the test page:
http://janodvarko.cz/har/tests/har-export-trigger/har-export-api.html

And the "Use HAR API" buttons all return "HAR is not defined" in console.

I've been attempting to get this working for several days now, and not making any progress. Would appreciate any advice.

Thanks in advance

pageTimings are always -1

I got har-export-trigger and selenium driver to create my HAR files. Everything works fine and HAR files are written as expected, however, in all HAR files below is the same. pageTimings are always -1. Any clues please. Attached are some HAR files for reference.

"pages": [
{
"startedDateTime": "2016-06-07T12:39:42.776+01:00",
"id": "page_1",
"title": "New Tab",
"pageTimings": {
"onContentLoad": -1,
"onLoad": -1

fwdhaarexporttrigger.zip

Just realised there was already a log on this issue
https://github.com/firebug/har-export-trigger/issues/5

har-export-trigger does not export serverIPAddress and connection params

I'm trying to get serverIPAddress property with HAR-export-trigger (harexporttrigger-0.5.0-beta.10.xpi) Problem is that serverIPAddress property is not defined for every entry, but if try to manually export HAR file from Firefox (47.0.1, 51.0.1), serverIPAddress property is correctly exported to HAR file.
See attachment- auto and manual

Generates invalid HAR file for www.expressen.se

Hi @janodvarko ,
we been testing the HAR export trigger a lot now in the coming version of https://github.com/tobli/browsertime and it works really good for us. There are some small tweaks but I mean it's the same problems with the HAR/waterfall inside Firefox. See when we can find the time to send PRs for those.

However, I found something today when I tested http://www.expressen.se (it's a Swedish newspaper site): There are some fields that are missing/invalid:
screen shot 2016-05-10 at 11 06 41

I've just upgraded to FF 46, and I haven't seen this before (but it can of course be new content on the site).

The HAR file:
https://gist.github.com/soulgalore/4071417f75753c0155dd83be0b60a4de

Best
Peter

Is serverIPAddress property supported?

Hello,

I'm trying to get serverIPAddress property with HAR-export-trigger (harexporttrigger-0.5.0-beta.9.xpi) instead of triggering DNS resolutions by myself. Problem is that serverIPAddress property is not defined for every entry, but if try to manually export HAR file from Firefox (46.0.1), serverIPAddress property is correctly exported to HAR file.

Am I missing something?
Thanks

Each request done twice in Firefox Nightly

When I try the latest version of the plugin (harexporttrigger-0.5.0-beta.10.xpi) together with Firefox Nightly 51.0a1 (2016-09-08) (64-bit) I get most request twice:

screen shot 2016-09-09 at 22 13 55

Running beta 7 with latest stable Firefox 48.0.1 works.

HAR export trigger + Selenium + Marionette

Has anyone got the trigger working with Selenium and Marionette (Geckodriver) for Firefox 47?

With Firefox 46 + Selenium everything worked just fine for us, but we haven't started using the Geckodriver so we where caught off guard with the release of 47.

We use Selenium NodeJS version and I started by setting the Firefox options to use marionette, downloaded the latest version of Geckodriver (0.8.0) and started to test. In Selenium Nodejs, you need to explicitly set the binary to Firefox 47 (using marionette defaults to Firefox Developer Edition).

To fetch the HAR we do like this:
https://github.com/tobli/browsertime/blob/1.0/lib/core/engineDelegate/firefoxDelegate.js#L36-L57

If I use FF 47 (and 46) with Marionette the scripts timeouts in Selenium. In 46 not using Marionette you could set the setScriptTimeout but that doesn't work with Marionette mozilla/geckodriver#77.

The har-api-ready event never kicks in for me. But could it be with the installation of the extension?

So has someone else tested the trigger with 47 and Marionette?

Best
Peter

har-api-ready not firing because of video?

I was kindly asked by the SiteSpeed.io guys to open a bug with you guys, as i'm having trouble to use Firefox in their Docker image to generate metrics for our site.

This is the command line i'm using:

docker run --privileged --shm-size=512m --rm --dns 192.168.21.2 sitespeedio/sitespeed.io:4.3.9 -n 3 -b firefox --browsertime.timeouts.script 80000 https://quazer.com/

and it crashes with this error:

Mozilla Firefox 50.1.0
[2017-02-03 07:24:43] Versions OS: linux 4.8.0-34-generic nodejs: v6.9.1 sitespeed.io: 4.3.9 browsertime: 1.0.0-beta.23 coach: 0.30.4
[2017-02-03 07:24:43] Starting firefox for analysing https://quazer.com/ 3 time(s)
[2017-02-03 07:24:43] Testing url https://quazer.com/ run 1
[2017-02-03 07:24:52] Testing url https://quazer.com/ run 2
[2017-02-03 07:26:21] Couldn't generate the HAR from Firefox from the HAR Export Trigger.
[2017-02-03 07:26:21] ScriptTimeoutError: Timed out
    at WebDriverError (/usr/src/app/node_modules/selenium-webdriver/lib/error.js:27:5)
    at ScriptTimeoutError (/usr/src/app/node_modules/selenium-webdriver/lib/error.js:203:5)
    at Object.throwDecodedError (/usr/src/app/node_modules/selenium-webdriver/lib/error.js:477:11)
    at parseHttpResponse (/usr/src/app/node_modules/selenium-webdriver/lib/http.js:499:15)
    at doSend.then.response (/usr/src/app/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Driver.schedule (/usr/src/app/node_modules/selenium-webdriver/lib/webdriver.js:816:17)
    at Driver.executeAsyncScript (/usr/src/app/node_modules/selenium-webdriver/lib/webdriver.js:900:17)
    at Promise.try (/usr/src/app/node_modules/browsertime/lib/core/seleniumRunner.js:188:28)
From previous event:
    at SeleniumRunner.runAsyncScript (/usr/src/app/node_modules/browsertime/lib/core/seleniumRunner.js:182:11)
    at FirefoxDelegate.onStopIteration (/usr/src/app/node_modules/browsertime/lib/core/engineDelegate/firefoxDelegate.js:50:19)
    at runner.start.tap.tap.tap.then.then.tap.tap (/usr/src/app/node_modules/browsertime/lib/core/engine.js:247:39)
From previous event:
    at runIteration (/usr/src/app/node_modules/browsertime/lib/core/engine.js:247:10)
    at Promise.reduce (/usr/src/app/node_modules/browsertime/lib/core/engine.js:285:25)
From previous event:
    at Promise.resolve.tap.tap.tap (/usr/src/app/node_modules/browsertime/lib/core/engine.js:284:17)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at Engine.run (/usr/src/app/node_modules/browsertime/lib/core/engine.js:283:8)
    at engine.start.then (/usr/src/app/lib/plugins/browsertime/analyzer.js:76:26)
From previous event:
    at Object.analyzeUrl (/usr/src/app/lib/plugins/browsertime/analyzer.js:76:8)
    at storageManager.createDirForUrl.then.then (/usr/src/app/lib/plugins/browsertime/index.js:132:34)
From previous event:
    at Object.processMessage (/usr/src/app/lib/plugins/browsertime/index.js:132:14)
    at queue.process (/usr/src/app/lib/support/queueHandler.js:157:57)
    at drainItem (/usr/src/app/node_modules/concurrent-queue/index.js:92:21)
    at Immediate.drain (/usr/src/app/node_modules/concurrent-queue/index.js:73:84)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)

It works fine if i use only 1 run, but crashes when using >1 run. The default is 3 runs, to get a median for the metrics.
Sometimes it even crashes with only 1 run if i don't use --browsertime.timeouts.script 80000.

They suspect the har-api-ready event doesn't fire because there's a video playing. The original issue report is here: sitespeedio/sitespeed.io#1345

Promise for har export in pending state

I am facing the issue similar to written in #18. This issue seems like resolved in Dec.
Can somebody please release a new version of this plugin? Thanks for all your help.

Weird behaviour in har file generation

For every page that is navigated to, 2 har files are getting generated.

The only difference in the 2 files is that some extra information related to page timings is present in the second har file. (Extra information present in the second har file - "cache": {}, "timings": {},"content": {
"mimeType": "image/png", "size": -1, "comment": "Response bodies are not included." },
"redirectURL": "", "headersSize": 372, "bodySize": 351} etc. )

Attached are a set a har files that got generated for 1 page navigation.

HarOutputDir.zip

is this expected ? should i discard the first har file for each page always ?

Im using firefox 43 and har_export_trigger-0.5.0-beta.7-fx

Selenium Python test

I wrote a simple selenium test driver with har-export-trigger, however, I don't see anything happening. I may be wrong.. please let me know.

`#! /usr/bin/python
import time
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

count = 0
while count < 5:
profile = webdriver.FirefoxProfile()
profile.add_extension("harexporttrigger-0.5.0-beta.4.xpi")

#set firefox preferences
profile.set_preference("app.update.enabled", 0)
domain = "devtools.netmonitor.har."

#set the preference for the trigger
profile.set_preference("extensions.netmonitor.har.contentAPIToken", "test")
profile.set_preference("extensions.netmonitor.har.autoConnect", True)
profile.set_preference(domain + "enableAutoExportToFile", True)
profile.set_preference(domain + "defaultLogDir", "/home/mohideen/test")
profile.set_preference(domain + "pageLoadedTimeout", 1500)

time.sleep(2)

#create firefox driver
driver = webdriver.Firefox(profile)
driver.get("https://www.python.org")
count=count+1
time.sleep(2)

#close the firefox driver after HAR is written
driver.close()

`

It opens up Firefox with no errors, i'm not sure if I'm entirely missing something.

I'm on Firefox 45

Page without HAR available

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

Reference lost - ReferenceError: HAR is not defined

Hi

I trying to get the HAR for youtube video, so what I do is basically the same actions for load HAR plugin (works with other sites):

  • Load the browser
  • Load the plugin
  • Go to youtube.com for login (HAR reference exists)
  • Wait for youtube.com redirection to home (HAR reference exists)
  • Load the video page (HAR reference is lost)

I trying to lose the reference with other video sites, but only happen with youtube (not always), so There's a way to lose the reference to HAR object?

Thanks for your response.

high `connecting` value in har file

Hello Honza,

This is probably again not an issue with the extension, but pointing out as it was really noticeable with a site of mine that has lots of resources served through Cloudflare.

As you may know, browser can re-use TCP connection, especially if keep-alive is enabled and honored. Again this may be a bug with the browser or maybe a setting in the browser that I need set, but I strongly believe that the dev. version of firefox doesn't re-uses TCP connection.

I'll provide a screenshot from two HAR files, one (on the left) exported using Firefox 42 and another one (on the right) exported using Firefox 40 with netexport.

har_difference

The image show only the first top resources. Going downwards, this keeps on increasing which is also strange ...

Also, checking the response header for the httpVersion, I see httpVersion: HTTP/1.1 however again, tcp connection is not being re-used and the har file has

blocked 0
dns 0
connect 26
send 0
wait 68
receive 0

Do you think its best to fill a bug with firefox directly or is this maybe normal ?

Bogdan

HAR.triggerExport() exports requests who are still w8ing for response

I have javascript script, that stores all HAR's to file:

var dump_i = 0;

function dump() {
  var options = {
    token: "test",
    fileName: "prefix-" + Date.now() + "-" + dump_i
  };
  dump_i++;

  HAR.triggerExport(options).then(result => {
    HAR.clear({token: options.token});
  });
}

setInterval(dump, 1000);

Problem here is, that HAR is saved (and then cleared) even if response is still not available.
How can I save only HAR's than have full response?

How would I export whole history of my browsing?

Hi there,

I just tested your extension and it works great for one page export scenario. I am wondering where it is possible to export all the data when "Enable persistent logs" feature is enabled: http://take.ms/ISapf

I use Python to work with Selenium on backend and here is my config:

profile.set_preference("devtools.netmonitor.har.enableAutoExportToFile", False)
profile.set_preference("extensions.netmonitor.har.contentAPIToken", "test")
profile.set_preference("extensions.netmonitor.har.autoConnect", True)
# to make sure that network traffic stays with me after page realod
profile.set_preference("devtools.webconsole.persistlog", True)
# to have "Network" tab open
WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_tag_name("body")).send_keys(
    Keys.ALT + Keys.COMMAND + 'q')

The code I use to create HAR file:

var options = {
  token: "test",
  fileName: "my test har file %Y, %H:%M:%S"  // Name of the file
};

HAR.triggerExport(options).then(result => {
  // The local file is available now, result.data is null since options.getData wasn't set.
});

So, now I get only last page in my HAR file. I want to export all data collected while browser was open i.e. everything shown on "Network" tab.

How could I do it?

har files not being generated + HAR not defined

Hello,

I am using Firefox Mozilla Firefox 53.0.2 with HAR Export Trigger version 0.5.0-beta.7 and I have the following settings in the browser:


devtools.netmonitor.har.defaultLogDir
devtools.netmonitor.har.enableAutoExportToFile ==> true
extensions.netmonitor.har.autoConnect  ==> true
extensions.netmonitor.har.contentAPIToken ==> test
extensions.netmonitor.har.enableAutomation ==> true

However, no har file is generated inside the folder that I specify. When I turn on the console in the devtools and type HAR, it says ReferenceError: HAR is not defined.

Could anyone help me debug this error?

wrong response.content.mimeType in har

Hello Honza,

There's a bug I found in my project and after checking it more, it seems the extension doesn't properly sets the mimeType in the response header.

I checked with "copy all as Har" and using the extension, the responses from the two is really different.

For example for the main request, the html file, you always get text/plain.

wrong_mime_type

Let me know if you need more details. Later I can try to see if I can help in fixing this.

Bogdan

Reference ERROR: HAR is not defined

Hi,
I feel this issue is being solved previously but i tried all the previous solutions and nothing is working

I am running the following
Firefox 53.0.3 on Window
HAR Export Trigger 0.5.0-beta.10 as add-on installed on Firefox
selenium 3.4.3
geckodriver v 0.16.1

The following Firefox settings are set:
devtools.netmonitor.har.enableAutoExportToFile=>false
extensions.netmonitor.har.contentAPIToken => test
extensions.netmonitor.har.enableAutomation => true
extensions.netmonitor.har.autoConnect => true

However, no har file is generated inside the folder that I specify .I'm not able to see the HAR object, and get the "ReferenceError: HAR is not defined" as an error .

har-export-trigger not creating report for multiple pages

har-export-trigger+selenium is not creating .har files for multiple pages.

I am using har-export-trigger along with selenium .I am expecting to creating har file for each page on till end of the scenario.But it is giving some random .har files that are not relevent.
also it is not giving the failure http service calls.

Fire har-page-ready event

An event indicating that the page is loaded (addition to "DOMContentLoad" and "load" events) should be fired into the content scope.

The event should be fired at the same moment when the default auto-export-to-file logic is executed.

Honza

HAR export not working on FF 49+

I've seen the older issues reported on HAR is not defined and tried all the solutions, but I can't make it work on Firefox 49+. I downgraded to FireFox 48.0b10 and it started working again.

I tried loading the test page http://janodvarko.cz/har/tests/har-export-trigger/har-export-api.html and that shows the same HAR is not defined error, no matter if I execute the trick in the FAQ's or not. Going back to 48 makes the test page work.

I am using the last signed version of the add on, so I guess I am not using the 0.5.0 Beta 10 version, but 0.5.0 Beta 7.

During a Selenium test on Firefox 49 I see these warnings, which could be related:

Full message: TypeError: this.attach(...) is undefined
Full stack: TriggerToolboxOverlay<.onReady/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://harexporttrigger-at-getfirebug-dot-com/lib/trigger-toolbox-overlay.js:126:7
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:937:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:816:7
this.PromiseWalker.scheduleWalkerLoop/<@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:750:11```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.