Skip to main content
Version: 3.7

Using Firefox browser with Playwright crawler

This example demonstrates how to use PlaywrightCrawler with headless Firefox browser.


To run this example on the Apify Platform, select the apify/actor-node-playwright-firefox image for your Dockerfile.

Run on
import { PlaywrightCrawler } from 'crawlee';
import { firefox } from 'playwright';

// Create an instance of the PlaywrightCrawler class.
const crawler = new PlaywrightCrawler({
launchContext: {
// Set the Firefox browser to be used by the crawler.
// If launcher option is not specified here,
// default Chromium browser will be used.
launcher: firefox,
async requestHandler({ request, page, log }) {
const pageTitle = await page.title();`URL: ${request.loadedUrl} | Page title: ${pageTitle}`);

await crawler.addRequests(['']);

// Run the crawler and wait for it to finish.

To see a real-world example of how to use PlaywrightCrawler in combination with RequestQueue to recursively scrape the Hacker News website check out the Playwright crawler example.