import { PlaywrightCrawler, Dataset } from 'crawlee';
import axe from 'axe-core';
const crawler = new PlaywrightCrawler({
async requestHandler({ request, page, enqueueLinks, log }) {
await page.addInitScript('./node_modules/axe-core/axe-min.js');
const title = await page.title();
log.info(`Title of ${request.loadedUrl} is '${title}'`);
const results = await axe.run();
console.log(results.violations)
await Dataset.pushData({ title, url: request.loadedUrl });
await enqueueLinks();
},
});
await crawler.run(['https://dequeuniversity.com/demo/mars/']);
import { PlaywrightCrawler, Dataset } from 'crawlee';
import axe from 'axe-core';
const crawler = new PlaywrightCrawler({
async requestHandler({ request, page, enqueueLinks, log }) {
await page.addInitScript('./node_modules/axe-core/axe-min.js');
const title = await page.title();
log.info(`Title of ${request.loadedUrl} is '${title}'`);
const results = await axe.run();
console.log(results.violations)
await Dataset.pushData({ title, url: request.loadedUrl });
await enqueueLinks();
},
});
await crawler.run(['https://dequeuniversity.com/demo/mars/']);