30 days challenge : Day 28 - UI testing

Hi, I’m trying to complete the day 28 about UI testing, where I need to request a document from pagespeedonline API, retrieve a score and save it.

I tried to do it for https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://www.example.com. However, the details for this challenge and I don’t know exactly which field to use in the tests - the return JSON has 1.5k lines of “code”, where the string “score” appears… 120 times!

Which field should I be using? I would post the response here but it’s too long… Help would be greatly appreciated!

As a rant, I think the challenge is great but the documentation about 3rd party libraries or APIs is a bit lackluster.

EDIT: found the answer.

By digging deeper into the docs of the pagespeed API (Get Started with the PageSpeed Insights API  |  Google Developers), with some trial and error, and even establishing a mock server to avoid exceeding quota for Page Speed requests, I was able to find the correct field: lighthouseResult.categories.performance.score, at line 1409. And unlike stated in the documentation, the score goes from 0 to 1.0, not from 0 to 100.

Maybe this was the ultimate Postman test!


Hi @pnt12,

In this case, you have to find the performance score of the website. In JSON response, you may need to search the same.

1 Like

Thank you @pranavdavar, but once again, this is a huge JSON with a tons of different scores.

By reading the docs and doing some trial and error I was able to find the answer. I will edit the OP with the answer to help others,


Dear all,
I think there is an alternative to @pnt12 solution. However I had a syntax issue in Postman.
Metrics contribute to the lighthouse performance score.
Here we are focused on those six metrics:
4.time to interactive

To calculate the performance score, we can apply the weighted average score to each metric score. The calculator can be checked for Weighting.
However I don’t pass through this error :
var speedIndex = JSON.stringify(jsonData.lighthouseResult[‘speed-index’][‘score’]);
There is a error in postman while trying to access each metric score.
Can someone help ?