I would like to measure how long it takes to load page B, provided I am already on page A. Ideally I'd fire a click event on the link to page B. I need to use lighthouse as a node module for this.

I tried setting site A as the chromeLauncher startingUrl.

function launchChromeAndRunLighthouse(url, opts, config = null) {
  return chromeLauncher.launch({
    chromeFlags: opts.chromeFlags}, {
    startingUrl: 'https://example.com/page-A.html'
  }).then(chrome => {
        opts.port = chrome.port;
        return lighthouse(url, opts, config).then(results => {
          return chrome.kill().then(() => results.lhr)
        });
  });
}

However while page B is loaded, I only get results for A. Also, no click event.

What I want is simply to measure with lighthouse the time it takes to get from page A to page B.

0 Answers