# JavaScript web scraping libraries

JavaScript web scraping libraries fetch web pages and extract structured data from their HTML. Pages that build their content with JavaScript need a headless browser to render them before extraction. These libraries let AI agents and data pipelines collect prices, listings, and articles from sites without an API.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Playwright](#playwright) | 642.0M | 99.9K | Nov 2026 | Apache-2.0 |
| [jsdom](#jsdom) | 603.4M | 21.8K | Nov 2026 | MIT |
| [Cheerio](#cheerio) | 138.0M | 30.5K | Jan 2026 | MIT |
| [Happy DOM](#happy-dom) | 130.1M | 4.8K | Oct 2026 | MIT |
| [puppeteer](#puppeteer) | 59.9M | 95.8K | Nov 2026 | Apache-2.0 |
| [Stagehand](#browserbasehq-stagehand) | 10.2M | 26.1K | Nov 2026 | MIT |
| [selenium-webdriver](#selenium-webdriver) | 8.2M | 34.6K | Nov 2026 | Apache-2.0 |
| [Firecrawl](#firecrawl) | 4.5M | 201.0K | Nov 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Playwright](#playwright) has the most monthly downloads in this comparison, at 576.3M.

## Capabilities

| Library | JavaScript rendering | In-process HTML DOM |
| --- | --- | --- |
| [Playwright](#playwright) | Yes | No |
| [jsdom](#jsdom) | Yes | Yes |
| [Cheerio](#cheerio) | No | Yes |
| [Happy DOM](#happy-dom) | Yes | Yes |
| [puppeteer](#puppeteer) | Yes | No |
| [Stagehand](#browserbasehq-stagehand) | Yes | No |
| [selenium-webdriver](#selenium-webdriver) | Yes | No |
| [Firecrawl](#firecrawl) | Yes | No |

## Libraries

### Playwright

[GitHub](https://github.com/microsoft/playwright) · [npm](https://www.npmjs.com/package/playwright) · [Docs](https://playwright.dev/docs/library)

Automates browser pages with unified APIs for multiple browser engines.

- Downloads / mo: 642.0M
- Stars: 99.9K
- Last release: 1.65.1
- License: Apache-2.0
- Capabilities: [From the Playwright docs](https://playwright.dev/docs/library)

**Strengths**

- **Supports Chromium, Firefox, and WebKit.** Use the same browser APIs across Chromium, Firefox, and WebKit.
- **Locators handle action readiness.** Use locators for built-in waiting when interacting with page elements.

**Watch out for**

- **Browser builds follow package versions.** Install the browser builds that the installed Playwright version requires.

```sh
npm install playwright
npx playwright install webkit
```

**firecrawl/firecrawl** (201.0K stars)

[firecrawl/firecrawl](https://github.com/firecrawl/firecrawl) 

```javascript
const scrapePage = async (
  page: Page,
  url: string,
  waitUntil: 'load' | 'networkidle',
  waitAfterLoad: number,
  timeout: number,
  checkSelector: string | undefined,
  securityState: ContextSecurityState,
) => {
  console.log(
    `Navigating to ${url} with waitUntil: ${waitUntil} and timeout: ${timeout}ms`,
  );
  let response;
  try {
    response = await page.goto(url, { waitUntil, timeout });
  } catch (error) {
    if (securityState.blockedNavigationRequestUrl) {
      throw new InsecureConnectionError(
        securityState.blockedNavigationRequestUrl,
        'navigation to private/internal resource is not allowed',
      );
    }
    throw error;
  }

  if (waitAfterLoad > 0) {
    await page.waitForTimeout(waitAfterLoad);
  }

  if (checkSelector) {
    try {
      await page.waitForSelector(checkSelector, { timeout });
    } catch (error) {
      throw new Error('Required selector not found');
    }
  }

  let headers = null,
    content = await page.content(),
    landedUrl = page.url();
  let ct: string | undefined = undefined;
  if (response) {
    headers = await response.allHeaders();
    ct = Object.entries(headers).find(
      ([key]) => key.toLowerCase() === 'content-type',
    )?.[1];
    if (
      ct &&
      (ct.toLowerCase().includes('application/json') ||
        ct.toLowerCase().includes('text/plain'))
    ) {
      content = (await response.body()).toString('utf8'); // TODO: determine real encoding
      landedUrl = response.url();
    }
  }

  return {
    content,
    // Where the returned content came from: page.url() for rendered HTML
    // (covers HTTP 3xx and client-side redirects), response.url() for raw
    // JSON/text bodies, which come from the page.goto response.
    url: landedUrl,
    status: response ? response.status() : null,
    headers,
    contentType: ct,
  };
};

```

[apps/playwright-service-ts/api.ts](https://github.com/firecrawl/firecrawl/blob/404a57968a67edf14ce21fe911474f9e31a3fc01/apps/playwright-service-ts/api.ts#L259-L325) · [More projects using Playwright →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20that%20use%20playwright&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
const { webkit } = require('playwright');

(async () => {
  const browser = await webkit.launch();
  const page = await browser.newPage();
  await page.goto('https://playwright.dev/');
  await page.screenshot({ path: `example.png` });
  await browser.close();
})();

```

From [library-js.md](https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/library-js.md)

### jsdom

[GitHub](https://github.com/jsdom/jsdom) · [npm](https://www.npmjs.com/package/jsdom) · [Docs](https://raw.githubusercontent.com/jsdom/jsdom/main/README.md)

Implements many web standards in JavaScript.

- Downloads / mo: 603.4M
- Stars: 21.8K
- Last release: 31.0.1
- License: MIT
- Capabilities: [From the jsdom docs](https://raw.githubusercontent.com/jsdom/jsdom/main/README.md)

```sh
npm install jsdom
```

**Quickstart**

```javascript
const jsdom = require("jsdom");
const { JSDOM } = jsdom;

const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
console.log(dom.window.document.querySelector("p").textContent); // "Hello world"

```

From [README.md](https://raw.githubusercontent.com/jsdom/jsdom/main/README.md) · [Find projects using jsdom →](https://dashboard.exa.ai/playground/search?q=jsdom%20GitHub%20projects)

### Cheerio

[GitHub](https://github.com/cheeriojs/cheerio) · [npm](https://www.npmjs.com/package/cheerio) · [Docs](https://cheerio.js.org/docs/intro)

Parses HTML and XML with a jQuery-like document API.

- Downloads / mo: 138.0M
- Stars: 30.5K
- Last release: 1.2.0
- License: MIT
- Capabilities: [From the Cheerio docs](https://cheerio.js.org/docs/intro)

**Strengths**

- **Extracts with CSS selectors.** Select elements with CSS selectors and read their text or attributes.
- **Loads from several input sources.** Load HTML from strings, buffers, streams, or URLs.

**Watch out for**

- **Dynamic content needs browser rendering.** Cheerio does not execute page scripts or render CSS layouts.

```sh
npm install cheerio
```

**langchain-ai/langchainjs** (18.3K stars)

[langchain-ai/langchainjs](https://github.com/langchain-ai/langchainjs) 

```javascript
static async _scrape(
    url: string,
    caller: AsyncCaller,
    timeout: number | undefined,
    textDecoder?: TextDecoder,
    options?: CheerioOptions
  ): Promise<CheerioAPI> {
    const { load } = await CheerioWebBaseLoader.imports();
    const response = await caller.call(fetch, url, {
      signal: timeout ? AbortSignal.timeout(timeout) : undefined,
    });
    const html =
      textDecoder?.decode(await response.arrayBuffer()) ??
      (await response.text());
    return load(html, options);
  }

```

[langchain/src/document_loaders/web/cheerio.ts](https://github.com/langchain-ai/langchainjs/blob/44ede93dd92e0515e56948f7b35a5fe0240e60bf/langchain/src/document_loaders/web/cheerio.ts#L96-L111) · [More projects using Cheerio →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20that%20use%20cheerio&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import * as cheerio from 'cheerio';

const $ = cheerio.load('<h2 class="title">Hello world</h2>');

$('h2.title').text(); // "Hello world"

```

From [intro.md](https://cheerio.js.org/docs/intro)

### Happy DOM

[GitHub](https://github.com/capricorn86/happy-dom) · [npm](https://www.npmjs.com/package/happy-dom) · [Docs](https://github.com/capricorn86/happy-dom/wiki/Browser)

Implements a web browser without its graphical interface, with WHATWG DOM and HTML standards.

- Downloads / mo: 130.1M
- Stars: 4.8K
- Last release: 21.0.4
- License: MIT
- Capabilities: [From the Happy DOM docs](https://github.com/capricorn86/happy-dom/wiki/Browser)

```sh
npm install happy-dom
```

**Quickstart**

```javascript
import { Browser, BrowserErrorCaptureEnum } from 'happy-dom';

const browser = new Browser({ settings: { errorCapture: BrowserErrorCaptureEnum.processLevel } });
const page = browser.newPage();

// Navigates page
await page.goto('https://github.com/capricorn86');

// Clicks on link
page.mainFrame.document.querySelector('a[href*="capricorn86/happy-dom"]').click();

// Waits for all operations on the page to complete (fetch, timers etc.)
await page.waitUntilComplete();

// Outputs "GitHub - capricorn86/happy-dom: Happy DOM..."
console.log(page.mainFrame.document.title);

// Aborts all ongoing operations and closes the browser
await browser.close();

```

From [Browser.md](https://github.com/capricorn86/happy-dom/wiki/Browser) · [Find projects using Happy DOM →](https://dashboard.exa.ai/playground/search?q=happy-dom%20GitHub%20projects)

### puppeteer

[GitHub](https://github.com/puppeteer/puppeteer) · [npm](https://www.npmjs.com/package/puppeteer) · [Docs](https://pptr.dev)

Controls Chrome and Firefox pages for browser-based automation and extraction.

- Downloads / mo: 59.9M
- Stars: 95.8K
- Last release: 25.18.1
- License: Apache-2.0
- Capabilities: [From the puppeteer docs](https://pptr.dev)

**Strengths**

- **Controls Chrome and Firefox.** Automate full browser pages through DevTools Protocol or WebDriver BiDi.
- **Captures full-page screenshots.** Enable fullPage to capture beyond the visible viewport.

**Watch out for**

- **Browser binaries need installation.** Run the browser-install command when install scripts skip the browser download.
- **PDFs use print styles.** Call emulateMediaType('screen') before pdf() when screen styles are required.

```sh
npm install puppeteer
```

**Quickstart**

```javascript
import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';

// Launch the browser and open a new blank page.
const browser = await puppeteer.launch();
const page = await browser.newPage();

// Navigate the page to a URL.
await page.goto('https://developer.chrome.com/');

await browser.close();

```

From [README.md](https://raw.githubusercontent.com/puppeteer/puppeteer/main/README.md) · [Find projects using puppeteer →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20that%20use%20puppeteer&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### Stagehand

[GitHub](https://github.com/browserbase/stagehand) · [npm](https://www.npmjs.com/package/@browserbasehq/stagehand) · [Docs](https://raw.githubusercontent.com/browserbase/stagehand/main/packages/docs/v4/first-steps/quickstart.mdx)

Builds browser agents on Browserbase.

- Downloads / mo: 10.2M
- Stars: 26.1K
- Last release: 4.4.0
- License: MIT
- Capabilities: [From the Stagehand docs](https://raw.githubusercontent.com/browserbase/stagehand/main/packages/docs/v4/first-steps/quickstart.mdx)

```sh
pnpm install @browserbasehq/stagehand 'zod@~4.4.3'
```

**Quickstart**

```javascript
import { localBrowser, Stagehand } from "@browserbasehq/stagehand";
import { z } from "zod/v4";

const { OPENAI_API_KEY } = process.env;
if (!OPENAI_API_KEY) throw new Error();

const browser = await localBrowser.launch({ headless: true });
const stagehand = await Stagehand.create({
 browser,
 model: {
 modelName: "openai/gpt-5.4-mini",
 apiKey: OPENAI_API_KEY,
 },
});

const [page] = await browser.context.pages();
await page.goto("https://stagehand-eval-sites.vercel.app/sites/example/");

const result = await stagehand.extract(
 "Extract the page heading and description",
 z.object({
 heading: z.string(),
 description: z.string(),
 }),
);

console.log(JSON.stringify(result.data, null, 2));

await stagehand.close();
await browser.close();

```

From [quickstart.mdx](https://raw.githubusercontent.com/browserbase/stagehand/main/packages/docs/v4/first-steps/quickstart.mdx) · [Find projects using Stagehand →](https://dashboard.exa.ai/playground/search?q=%40browserbasehq/stagehand%20GitHub%20projects)

### selenium-webdriver

[GitHub](https://github.com/SeleniumHQ/selenium) · [npm](https://www.npmjs.com/package/selenium-webdriver) · [Docs](https://www.selenium.dev/selenium/docs/api/javascript/WebDriver.html)

Provides the official Selenium WebDriver bindings for JavaScript.

- Downloads / mo: 8.2M
- Stars: 34.6K
- Last release: 4.53.0
- License: Apache-2.0
- Capabilities: [From the selenium-webdriver docs](https://www.selenium.dev/selenium/docs/api/javascript/WebDriver.html)

```sh
npm install selenium-webdriver
```

**sitespeedio/browsertime** (653 stars)

[sitespeedio/browsertime](https://github.com/sitespeedio/browsertime) 

```javascript
async loadAndWait(url, pageCompleteCheck, engine) {
    const driver = this.driver;
    // Browsers may normalize 'https://x.com' differently; in particular, Firefox normalizes to
    // 'https://x.com/'.  This is a first normalization attempt; there are deeper options that order
    // query parameters, order fragments, etc.  We don't want to change url itself 'cuz it can be
    // used for indexing collected data and it is possible that normalization could change a key.
    const normalizedURI = new URL(url).toString();

    // See  https://github.com/sitespeedio/browsertime/issues/1698
    const retries = 5;
    let documentURI;
    for (var index = 0; index < retries; index++) {
      documentURI = await driver.executeScript('return document.documentURI;');
      if (documentURI != undefined) {
        break;
      }
      await delay(1000);
    }
    let startURI;
    try {
      startURI = new URL(documentURI).toString();
    } catch (error) {
      log.error(`Failed to get documentURI ${documentURI}`, error);
    }
    if (this.options.webdriverPageload) {
      const clearOrange = `(function() {
        const orange = document.getElementById('browsertime-orange');
        if (orange) {
          orange.parentNode.removeChild(orange);
        }
        })();`;
      await driver.executeScript(clearOrange);
      log.debug('Using webdriver.get to navigate');
      await driver.get(url);
    } else {
      // To learn more about the event loop and request animation frame
      // watch Jake Archibald on ‘The Event Loop’ https://vimeo.com/254947206
      // TODO do we only want to do this when we record a video?
      const navigate = `(function() {
          const orange = document.getElementById('browsertime-orange');
          if (orange) {
            orange.parentNode.removeChild(orange);
          }
          window.requestAnimationFrame(function(){
            window.requestAnimationFrame(function(){
              window.location=${JSON.stringify(url)};
            });
          });
        })();`;
      // Navigate to the page
      log.debug('Using window.location to navigate');
      await driver.executeScript(navigate);
    }

    if (this.options.pageCompleteCheckNetworkIdle) {
      return engine.waitForNetworkIdle(driver);
    } else {
      // If you run with default settings, the webdriver will give back
      // control ASAP. Therefore you want to wait some extra time
      // before you start to run your page complete check
      this.options.pageLoadStrategy === 'none'
        ? await delay(this.options.pageCompleteCheckStartWait || 5000)
        : await delay(2000);

      // We give it a couple of times to finish loading, this makes it
      // more stable in real case scenarios on slow servers.
      let totalWaitTime = 0;
      const tries = getProperty(this.options, 'retries', 5) + 1;
      for (let index = 0; index < tries; ++index) {
        try {
          await this._waitOnPageCompleteCheck(pageCompleteCheck, normalizedURI);
          const newURI = new URL(
            await driver.executeScript('return document.documentURI;')
          ).toString();
          // If we use a SPA it could be that we don't test a new URL so just do one try
          // and make sure your page complete check take care of other things
          if (this.options.spa) {
            break;
          } else if (normalizedURI === startURI) {
            // You are navigating to the current page
            break;
          } else if (normalizedURI.startsWith('data:text')) {
            // Navigations between data/text seems to don't change the URI
            break;
          } else if (newURI === 'chrome-error://chromewebdata/') {
            // This is the timeout URL for Chrome, just continue to try
            throw new UrlLoadError(
              `Could not load ${url} is the web page down?`,
              url
            );
          } else if (newURI === startURI) {
            const waitTime =
              (this.options.retryWaitTime || 10_000) * (index + 1);
            totalWaitTime += waitTime;
            log.debug(
              `URL ${url} failed to load, the ${
                this.options.browser
              } are still on ${startURI} , trying ${
                tries - index - 1
              } more time(s) but first wait for ${waitTime} ms.`
            );

            if (index === tries - 1) {
              // If the last tries through an error, rethrow as before
              const message = `Could not load ${url} - the navigation never happend after ${tries} tries and total wait time of ${totalWaitTime} ms`;
              log.error(message);
              throw new UrlLoadError(message, url);
            } else {
              // We add some wait time before we try again
              await delay(waitTime);
              log.info(
                'Will check again if the browser has navigated to the page'
              );
            }
          } else {
            // We navigated to a new page, we don't need to test anymore
            break;
          }
        } catch (error) {
          log.info(
            `URL failed to load, trying ${tries - index - 1} more time(s): ${
              error.message
            }`
          );
          //
          if (index === tries - 1) {
            // If the last tries through an error, rethrow as before
            log.error('Could not load URL %s', url, error);
            throw new UrlLoadError('Failed to load ' + url, url, {
              cause: error
            });
          } else {
            await delay(1000);
          }
        }
      }
    }
  }
```

[lib/core/seleniumRunner.js](https://github.com/sitespeedio/browsertime/blob/main/lib/core/seleniumRunner.js#L270-L407) · [More projects using selenium-webdriver →](https://dashboard.exa.ai/playground/search?q=selenium-webdriver%20GitHub%20projects)

**Quickstart**

```javascript
const { Builder, Browser } = require('selenium-webdriver')

;(async function example() {
  let driver = await new Builder().forBrowser(Browser.CHROME).build()
  try {
    await driver.get('https://www.selenium.dev')
    console.log(await driver.getTitle())
  } finally {
    await driver.quit()
  }
})()

```

From [README.md](https://registry.npmjs.org/selenium-webdriver/4.53.0)

### Firecrawl

[GitHub](https://github.com/firecrawl/firecrawl) · [npm](https://www.npmjs.com/package/firecrawl) · [Docs](https://docs.firecrawl.dev/sdks/node)

Searches, scrapes, crawls, and maps the web through the Firecrawl API for AI agents.

- Downloads / mo: 4.5M
- Stars: 201.0K
- Last release: 4.54.0
- License: MIT
- Capabilities: [From the Firecrawl docs](https://docs.firecrawl.dev/sdks/node)

```sh
npm install firecrawl
```

**Quickstart**

```javascript
import { Firecrawl } from 'firecrawl';

const app = new Firecrawl({ apiKey: 'fc-YOUR_API_KEY' });

// Scrape a website
const scrapeResponse = await app.scrape('https://firecrawl.dev', {
  formats: ['markdown', 'html'],
});
console.log(scrapeResponse);

```

From [README.md](https://cdn.jsdelivr.net/npm/@mendable/firecrawl-js@4.54.0/README.md) · [Find projects using Firecrawl →](https://dashboard.exa.ai/playground/search?q=firecrawl%20GitHub%20projects)

## FAQ

### Which JavaScript web scraping library should I use?

[Cheerio](#cheerio) suits static pages whose data is already in the server's HTML. [Playwright](#playwright) and [puppeteer](#puppeteer) suit pages that render content with JavaScript. [Firecrawl](#firecrawl) suits AI agents that want clean page content from a hosted API.

### What is Firecrawl?

[Firecrawl](#firecrawl) is a hosted API that searches, scrapes, crawls, and maps websites for AI agents. Its JavaScript SDK returns page content as Markdown or structured data.

### What is Puppeteer?

[puppeteer](#puppeteer) is a Node.js library that controls Chrome and Firefox through a high-level API. Scrapers use it to load pages, wait for content, and read the rendered DOM.

### What is Cheerio?

[Cheerio](#cheerio) parses HTML and XML and exposes a jQuery-like API for selecting elements. It does not run page scripts or render the page.

### Selenium vs Playwright: which should I use?

[selenium-webdriver](#selenium-webdriver) drives browsers through the WebDriver standard. [Playwright](#playwright) controls Chromium, Firefox, and WebKit through its own protocol with automatic waiting.

### Puppeteer vs Playwright: which should I use?

[puppeteer](#puppeteer) controls Chrome and Firefox from Node.js. [Playwright](#playwright) adds WebKit and ships clients for Python, Java, and .NET as well.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "JavaScript web scraping libraries Puppeteer Playwright Cheerio Crawlee browser rendering queues retries CSS extraction code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
