灯塔NPM的互动时间和PageSpeed评分有时会失败

时间:2019-05-14 11:56:50

标签: npm puppeteer pagespeed lighthouse pagespeed-insights

我正在使用lighthouse npm测试一些随机URL ...有时它会因退出而失败

['audits']['interactive']['rawValue']

['categories']['performance']['score']

空。

在配置中是否有一些东西可以避免这种情况,或者“请重试,直到它不再失败”是我最好的选择。

这是我的设置。是木偶+灯塔

    Start Puppeteer + open URL
    const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
    const page = await browser.newPage()
    await page.goto(urlToTest, {
        waitUntil: 'networkidle2',
        timeout: 0
    });

    //Start Lighthouse 
    let opts = {
        chromeFlags: ['--show-paint-rects'],
        output: 'html',
        throttlingMethod: 'provided',
        throttling: {   
            throughputKbps: 8000,
            downloadThroughputKbps: 8000,
            uploadThroughputKbps: 2000
        }
    };

    opts.port = (new URL(browser.wsEndpoint())).port;
    let lighthouseResults = await lighthouse(urlToTest, opts, config = null);

0 个答案:

没有答案