Set up HAR files for desktop web testing

Perfecto supports recording HAR files during desktop web testing.

This article explains how to view WebSocket traffic and details any known limitations. For information on accessing the HAR file through the PerfectoUI, see Retrieve a HAR file.

To capture the HAR file, you need to add the captureHAR capability to your script and set it to true, as follows:

Copy
capabilities.setCapability("captureHAR", true);

Limitations

The following limitations apply: 

  • Certificate Pinning is not supported.
  • Recording HAR files during desktop web testing is not supported on Mac OS X.

View WebSocket traffic

If your website uses WebSockets, they appear in the generated HAR file under _webSocketMessages, the same way that Google Chrome shows WebSocket traffic in its exported HAR file. Following is a sample _webSocketMessages section.

Copy
        "_webSocketMessages": [
          {
            "type": "send",
            "time": 1585748977770,
            "opcode": 1,
            "data": "Hello, WebSockets!"          },
          {
            "type": "receive",
            "time": 1585748977789,
            "opcode": 1,
            "data": "Hello, WebSockets!"          },
          {
            "type": "send",
            "time": 1585748979343,
            "opcode": 1,
            "data": "Good Bye, WebSockets!"          },
          {
            "type": "receive",
            "time": 1585748979347,
            "opcode": 1,
            "data": "Good Bye, WebSockets!"          }
        ]

The complete sample file is available as a PDF for convenient preview or as a downloadable JSON file.