Audit a web page (performance, accessibility, etc.) with Lighthouse


#1

Sample project used in this topic: https://github.com/katalon-studio-samples/katalon-studio-chrome-devtools-protocol-plugin-samples

This topic covers how to collect performance metrics of Google web page using Lighthouse, then generate a report on its performance, accessibility and more. From there, the audits can be used as indicators for improving the web page.

Prerequisites

Instructions

  1. Open browser and navigate to Google web page.
WebUI.openBrowser('https://www.google.com')
  1. Get the current tab url as well as host and port of the current browser instance.
String url = WebUI.getUrl()
def (host, port) = CdpUtils.getServiceEndpoint()
  1. Audit the web page in a new tab with Lighthouse.
OsUtils.runCommand("lighthouse ${url} --hostname ${host} --port ${port} --no-enable-error-reporting", null, null)
  1. Finally, clean up and close the browser.
WebUI.closeBrowser()
  1. An HTML file will be generated in the root of the project.

[NEW] Page Audit Using Katalon + CDP + Lighthouse