Convert browser session from HAR

Learn how to record a browser session as HTTP Archive (HAR) and convert it to a test case.

What is HAR?

A HAR file is a JSON-formatted file, which contains the logging of a browser interaction with a site. Most browsers will record all meta data on requests they make and also all meta data on responses they receive from the server. This includes URLs, paths, headers, authentication etc. If you want to learn more about the format, you can check out the HAR specification at:

A HAR file basically looks like this:

{
  "log": {
    "pages": [
      {
        "startedDateTime": "2017-04-11T15:35:53.347Z",
        "id": "page_25",
        "title": "http://stormforger.com",
        "pageTimings": {
          "onContentLoad": 1.00000,
          "onLoad": 1.10000
        }
      }
    ]
  },
  {...}
}

How to create a HAR file

We're using in this example the Google Chrome Browser.

  1. Open your Google Chrome
  2. Open Chrome DevTools (Cmd + Opt + I or Ctrl + Shift + I) and select Network
  3. Activate the option "preserve log" to save all requests/responses and not to lose the requests/responses after you switch to another page
  4. Open any pages you want to be recorded, submit forms, etc.
  5. When you're done, you can right click any record in the network inspector
  6. Choose "Copy" and choose then "Copy all as HAR"
  7. Create a new file in your favorite editor and paste the copied HAR into that file
  8. Upload this file using our HAR Converter

Converting HAR to test case

HAR upload

You can upload and convert a HAR file containing requests using our HAR Converter.

You will get a preview of your newly generated test case and the option to save it in one of your organizations.

Notice: You should not upload recorded sessions which include sensitive data like login credentials. We will store converted test cases temporarily. You should also review your converted test case, to make sure everything is correct.

Command Line Tool

You can also use our Forge CLI to convert your HAR file into a test case. For example:

forge har your-har-file.har > your-test-case-file.js