Skip to main content
Version: 3.1



  • createPlaywrightRouter<Context>(): RouterHandler<Context>

  • Creates new Router instance that works based on request labels. This instance can then serve as a requestHandler of your PlaywrightCrawler. Defaults to the PlaywrightCrawlingContext.

    Serves as a shortcut for using Router.create<PlaywrightCrawlingContext>().

    import { PlaywrightCrawler, createPlaywrightRouter } from 'crawlee';

    const router = createPlaywrightRouter();
    router.addHandler('label-a', async (ctx) => {'...');
    router.addDefaultHandler(async (ctx) => {'...');

    const crawler = new PlaywrightCrawler({
    requestHandler: router,

    Type parameters

    • Context: PlaywrightCrawlingContext<Dictionary<any>, Context> = PlaywrightCrawlingContext<Dictionary<any>>

    Returns RouterHandler<Context>