@a11ycore/puppeteer 中文文档教程

发布于 4年前 浏览 22 项目主页 更新于 3年前

@a11ycore/puppeteer

npm 版本 NPM

aXe 用于测试可访问性

⚠️✋ This project does not guarantee what you build is accessible.

GDS 可访问性团队发现只有 ~30% 的问题是通过自动化测试发现的

Installation:

npm install --save-dev @a11ycore/puppeteer

Usage:

const puppeteer = require('puppeteer');
const { runA11yPuppeteer } = require('@a11ycore/puppeteer');

describe(() => {
  it('should check the page for a11y' async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.setBypassCSP(true);

    await page.goto('https://thewebuiguy.com');

    const results = await runA11yPuppeteer(page);
    console.log(results);

    await page.close();
    await browser.close();
  });
}); 

请参阅开发 Axe-core 规则以获取有关如何开发自定义规则的说明规则和检查。

Thanks

  • aXe for the wonderful axe-core that makes it so easy to do this.
  • Government Digital Service for making coding in the open the default.
  • GOV.UK Publishing Frontend team who published the basis of the aXe reporter

@a11ycore/puppeteer

npm version NPM

Custom [Puppetter] runner matcher for aXe for testing accessibility

⚠️✋ This project does not guarantee what you build is accessible.

The GDS Accessibility team found that only ~30% of issues are found by automated testing.

Installation:

npm install --save-dev @a11ycore/puppeteer

Usage:

const puppeteer = require('puppeteer');
const { runA11yPuppeteer } = require('@a11ycore/puppeteer');

describe(() => {
  it('should check the page for a11y' async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.setBypassCSP(true);

    await page.goto('https://thewebuiguy.com');

    const results = await runA11yPuppeteer(page);
    console.log(results);

    await page.close();
    await browser.close();
  });
}); 

Refer to Developing Axe-core Rules for instructions on how to develop custom rules and checks.

Thanks

  • aXe for the wonderful axe-core that makes it so easy to do this.
  • Government Digital Service for making coding in the open the default.
  • GOV.UK Publishing Frontend team who published the basis of the aXe reporter
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文