As some of you know Perfecto provides the functionality that enables you to Generate and Analyze HAR files. If you want to automate the process of the HAR files downloading this article is for you.
Let’s start with the prerequisites:
Capabilities caps = driver.getCapabilities();
String externalID = (String) caps.getCapability("executionId");
For your convenience of testing you can print it like this:
System.out.println("externalID: " + externalID);
Having the prerequisites all set you can now continue:
To download the file in an automated manner (Let’s see how I have done with the help of Postman):
Click on “Header” and type the Key and the Value accordingly:
The result should look like this:
Here you have an “externalID”, like the one you have in the Prerequisites (you may need to search for it using the CTRL+F fucntion):
Determining the same “externalID” as the one in the code is essential for the determining the right test you are going to download the HAR file for.
Few lines below our “externalID” you will find “path” like this one (under “artifacts”):
This is the path you need!
When you follow it you will be taken to a ZIP file, you can download and extract. The HAR file is two levels below:
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.