HAR capture utility
An HTTP Archive (HAR) file is a JSON-formatted archive file format for logging an application’s (either browser or a native/hybrid app) interaction with HTTP servers. The HAR file format is an evolving standard, and the information contained within it is both flexible and extensible. You can expect a HAR file to include a breakdown of timings, including:
- How long it takes to fetch DNS information.
- How long each object takes to be requested.
- How long it takes to connect to the server.
- How long it takes to transfer assets from the server to the browser of each object.
See Set up HAR files for mobile testing to install a HAR certificate and capture the network traffic via automation.
With the HAR Capture Java utility, you can work on a real device in the Perfecto UI. While manually navigating through the different screens of an application, you can use the tool to capture the transactional network traffic along with the HAR certificate installation on the device. The tool will download the HAR reports to the given location. Alternatively, you can also download the HAR reports from Perfecto reports post-execution.
Prerequisites
Using the sample Java utility requires the following:
1 | Install and run the Java utility
The following procedure walks you through installing and running the Java utility.
To install and run the Java utility:
- Download the compressed utility file: https://github.com/GuruAtPerfecto/HARCaptureUtility
- Extract the downloaded zip file.
- In a command-line window, navigate to the folder that contains the extracted files.
-
Execute the following command:
Copyjava -jar <<JARNAME.jar>>
For example:
Copyjava -jar JavaPerfectoHARUtility.jar
This should bring up the Java utility window.
2 | Use the Java utility to capture network traffic
You can use the Java utility to test mobile and web applications. Continue with the steps relevant to you.

This procedure walks you through using the sample Java utility to set up up HAR files for mobile testing before attempting to capture mobile network traffic of web or mobile applications. You can also view this (soundless) video to follow along.
To install a HAR certificate:
- Log in to your Perfecto cloud and open the device in the Manual Testing view.
-
In the Java utility, provide the following required details:
-
Perfecto Cloud URL: Your cloud URL, for example https://demo.app.perfectomobile.com.
-
User Security Token: Your security token for the Perfecto cloud. See also Generate a Perfecto security token.
-
Device Session ID: The session ID as copied from the device in the Perfecto cloud. For more information, see Share a session with an IDE script.
-
Transaction Name: A meaningful name for the current screen, such as AndroidCertificateInstall.
-
Output Folder: The local folder to which to download and where to store HAR reports.
-
Proxy: Select if you need to connect through a proxy to enable the Proxy Host and Proxy Port. Then provide the required information. For more information, see Identify proxy host and proxy port through Netstat. If your proxy requires credentials, provide them in the User Name and Password fields.
-
-
Click Install Certificate.
- Wait for the confirmation and click OK.
- Following the instructions in the install wizard. For more details, follow the instructions in Set up HAR Files for mobile testing.
- When the certificate is successfully installed on the device, click Finish.
The configured device is now ready to capture transactional network traffic.

This procedure walks you through using the sample Java utility to capture mobile network traffic of web or mobile applications. You can also view this (soundless) video to follow along.
To capture transactional network traffic:
- Log in to your Perfecto cloud and open the device in the Manual Testing view.
-
In the Java utility, provide the following required details:
-
Perfecto Cloud URL: Your cloud URL, for example, https://demo.app.perfectomobile.com.
-
User Security Token: Your security token for the Perfecto cloud. See also Generate a Perfecto security token.
-
Device Session ID: The session ID as copied from the device in the Perfecto cloud. For more information, see Share a session with an IDE script.
-
Transaction Name: A meaningful name for the current screen, such as AndroidLaunchApp.
-
Output Folder: The local folder to which to download and where to store HAR reports.
-
Proxy: Select if you need to connect through a proxy to enable the Proxy Host and Proxy Port. Then provide the required information. For more information, see Identify proxy host and proxy port through Netstat. If your proxy requires credentials, provide them in the User Name and Password fields.
-
-
Click Start. An information message displays.
-
Click OK to close the message. A progress bar indicates the progress of the installation. When done, a success message displays.
- Click OK to close the message.
-
Perform transation operation on the device. When done, click Stop. A success message appears.
- Click OK to close the message.
-
Repeat these steps for each transaction you want to capture. Make sure to update the Transation Field each time. For example, if you already captured the laucnh app flow and want to capture the login flow, enter AndroidLoginApp as a transation name, as shown in the following image.
To download the HAR file:
- Close the device.
- Click Download HAR.
-
To confirm that the device is close, click Yes.
The Java Utility automatically downloads the HAR file with the values provided in the Transaction Name field into the selected output directory. When the report generation is complete, a success message displays.
- Click OK to close the message.
-
Navigate to the output folder. A subfolder exists for each transaction captured. Each transaction folder contains a .zip file that includes the .har file.
-
Extract the .zip file and load any available HAR viewer for analysis. The following sample image shows http://www.softwareishard.com/har/viewer/.