-
Notifications
You must be signed in to change notification settings - Fork 0
Config File Example
Hideki Abe edited this page May 22, 2021
·
8 revisions
axe-runner.config.js
のサンプルです。変更したい内容のみ記述してください。
axe-runner.config.js
を用意しない場合は、Google Chrome拡張を使用した場合とほぼ同じ結果が日本語で出力されます。
- device: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
- config: https://www.deque.com/axe/core-documentation/api-documentation/#api-name-axeconfigure
- context: https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter
- options: https://www.deque.com/axe/core-documentation/api-documentation/#user-content-options-parameter
あくまでもサンプルです。変更したい内容のみ記述してください。
// Attention
// Do not write context when you do not change the setting. An error will occur.
// The locale choices are: en, da, de, es, eu, fr, ja, ko, nl, pl, pt_BR.
module.exports = {
device: "iPhone 11",
config: {
locale: 'en',
},
context: {
include: [['.article-body']],
},
options: {
runOnly: ['wcag2a', 'wcag21a'],
resultTypes: ['violations'],
},
interval: 1,
navigateOptions: {
waitUntil: 'networkidle0',
},
};
-
device
を何も指定しない場合はビューポートが幅1280px、高さ800pxのパソコン相当の設定になります - あくまでもユーザーエージェントやビューポートの幅・高さなどが変わるだけで、ブラウザのエンジンが変わるわけではないことに注意してください。
module.exports = {
device: {
name: "iPhone SE landscape",
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1",
viewport: {
width: 568,
height: 320,
deviceScaleFactor: 2,
isMobile: true,
hasTouch: true,
isLandscape: true
}
},
};
ページを読みこむ際のオプションをnavigateOptions
で指定可能です。
詳細はPuppeteerのgoto()を参照してください。
waitUntil
はデフォルトではload
ですが、networkidle0
を指定してネットワーク接続がなくなるまで待機させることもできます。この設定により、出力される結果も若干変わります。
The locale choices are: en, da, de, es, eu, fr, ja, ko, nl, pl, pt_BR.
module.exports = {
config: {
locale: 'en',
},
};