The Lightpanda browser is compatible to run on windows inside WSL. Follow the Linux instruction for installation from a WSL terminal.
It is recommended to install clients like Puppeteer on the Windows host.
Install from Docker
Lightpanda provides official Docker
images for both Linux amd64 and
arm64 architectures.
The following command fetches the Docker image and starts a new container exposing Lightpandaâs CDP server on port 9222.
1
docker run -d --name lightpanda -p 9222:9222 lightpanda/browser:nightly
Dump a URL
1
./lightpanda fetch --obey_robots --log_format pretty --log_level info https://demo-browser.lightpanda.io/campfire-commerce/
'use strict'importpuppeteerfrom'puppeteer-core';// use browserWSEndpoint to pass the Lightpanda's CDP server address.
constbrowser=awaitpuppeteer.connect({browserWSEndpoint:"ws://127.0.0.1:9222",});// The rest of your script remains the same.
constcontext=awaitbrowser.createBrowserContext();constpage=awaitcontext.newPage();// Dump all the links from the page.
awaitpage.goto('https://demo-browser.lightpanda.io/amiibo/',{waitUntil:"networkidle0"});constlinks=awaitpage.evaluate(()=>{returnArray.from(document.querySelectorAll('a')).map(row=>{returnrow.getAttribute('href');});});console.log(links);awaitpage.close();awaitcontext.close();awaitbrowser.disconnect();
Telemetry
By default, Lightpanda collects and sends usage telemetry. This can be disabled by setting an environment variable LIGHTPANDA_DISABLE_TELEMETRY=true. You can read Lightpandaâs privacy policy at: https://lightpanda.io/privacy-policy.
Status
Lightpanda is in Beta and currently a work in progress. Stability and coverage are improving and many websites now work.
You may still encounter errors or crashes. Please open an issue with specifics if so.
An external Go runner is provided by
github.com/lightpanda-io/demo/
repository, located into wptrunner/ dir.
You need to clone the project first.
First start the WPTâs HTTP server from your wpt/ clone dir.
1
./wpt serve
Run a Lightpanda browser
1
zig build run -- --insecure_disable_tls_host_verification
Then you can start the wptrunner from the Demoâs clone dir:
1
cd wptrunner && go run .
Or one specific test:
1
cd wptrunner && go run . Node-childNodes.html
wptrunner command accepts --summary and --json options modifying output.
Also --concurrency define the concurrency limit.
:warning: Running the whole test suite will take a long time. In this case,
itâs useful to build in releaseFast mode to make tests faster.
1
zig build -Doptimize=ReleaseFast run
Contributing
Lightpanda accepts pull requests through GitHub.
You have to sign our CLA during the pull request process otherwise
weâre not able to accept your contributions.
Why?
Javascript execution is mandatory for the modern web
In the good old days, scraping a webpage was as easy as making an HTTP request, cURL-like. Itâs not possible anymore, because Javascript is everywhere, like it or not:
Ajax, Single Page App, infinite loading, âclick to displayâ, instant search, etc.
JS web frameworks: React, Vue, Angular & others
Chrome is not the right tool
If we need Javascript, why not use a real web browser? Take a huge desktop application, hack it, and run it on the server. Hundreds or thousands of instances of Chrome if you use it at scale. Are you sure itâs such a good idea?
Heavy on RAM and CPU, expensive to run
Hard to package, deploy and maintain at scale
Bloated, lots of features are not useful in headless usage
Lightpanda is built for performance
If we want both Javascript and performance in a true headless browser, we need to start from scratch. Not another iteration of Chromium, really from a blank page. Crazy right? But thatâs what we did:
Not based on Chromium, Blink or WebKit
Low-level system programming language (Zig) with optimisations in mind