Comments (1)
import fs from 'fs';
import lighthouse from 'lighthouse';
import * as chromeLauncher from 'chrome-launcher';
const chrome = await chromeLauncher.launch({chromeFlags: ['--headless']});
const options = {logLevel: 'info', output: 'html', onlyCategories: ['performance'], port: chrome.port};
const runnerResult = await lighthouse('https://example.com', options);
// .report
is the HTML report as a string
const reportHtml = runnerResult.report;
fs.writeFileSync('lhreport.html', reportHtml);
// .lhr
is the Lighthouse Result as a JS object
console.log('Report is done for', runnerResult.lhr.finalDisplayedUrl);
console.log('Performance score was', runnerResult.lhr.categories.performance.score * 100);
await chrome.kill();
from chrome-launcher.
Related Issues (20)
- Reporting unsuccessful exit code
- crash when launch with remote debugging pipe
- Reuse an existing window HOT 1
- RangeError [ERR_FS_FILE_TOO_LARGE]: File size (3055630622) is greater than 2 GiB
- Beta and Dev channels are not detected
- igmore
- /Users/sample/node_modules/chrome-launcher/dist/chrome-finder.js:14 const log = require('lighthouse-logger'); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module HOT 1
- Unknown error when ChromeLauncher.launch() in worker thread HOT 1
- Version v0.15.2 and kill chrome instance HOT 3
- Update readme for 1.0.0: ERR_REQUIRE_ESM
- `prefs` option doesn't work HOT 3
- Issue determining temp dir path HOT 1
- flag for setting useragentdata
- How to access environments variable with JS in chrome?
- move the red error dot to the console tab where it belongs HOT 1
- Add `--enable/disable-features=ChromeRootStoreUsed` flag HOT 2
- `user-data-dir` improperly replaced with Win32 path when running in WSL
- prefs option is incorrectly treated as a flat Record<string,JSONLike>, nested objects are not merged but overwritten HOT 1
- Search-engine dialog HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chrome-launcher.