Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Jun 06, 2018 17:14

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.

Step-by-step guide

Let’s start with the prerequisites:

  1. You need to add these lines to your code obtain the executionID, which will later be used as anchor for finding the test ID:

                        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);

  1. You need to have a security Token, providing you with the ability to authenticate to your cloud.
  2. Follow this article on how to generate the HAR file. Stop upon reaching the “Retrieving the HAR file” part as the mentioned download method is manual.
  3. For my testing purposes I have installed Postman.

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):

  1. Go for an HTTP GET with the following data:
               -          URL: https://<your-cloud>
               -          Header:
                                  Key: PERFECTO_AUTHORIZATION
                                  Value: your security Token
  2. Click on “New”:
  3. Select “Request”:
  4. Fill up the Name and select a Collection:
  5. Click “Save to <your Collection>”:
  6. Enter the URL https://<your-cloud> (change <your-cloud> with the name of your cloud)

    Click on “Header” and type the Key and the Value accordingly:

  7. Click “Send”:

  8. 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):

  9. 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!

  10. When you follow it you will be taken to a ZIP file, you can download and extract. The HAR file is two levels below: