Axe DevTools for Web Capybara

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard

axe-devtools-capybara gemの設定と使用方法

Not for use with personal data

このaxe-devtools-capybara gemは、axe APICapybara WebDriverのためにチェーン可能に提供し、すべてのフレームに自動的に注入します。

セットアップと使用方法

開始する前に、Deque's registryにアクセスできることを確認してください。もしそうでない場合は、refer to the setup guide

  • あなたのGemfileまたはgemspecファイルにaxe-devtools-capybaraを追加し、bundle installを実行します。
gem "axe-devtools-capybara"
spec.add_dependency "axe-devtools-capybara"
  • 以下のようにgemを要求して設定してください:
require 'axe-devtools-capybara'

# configure `AxeCapybara`
driver = AxeCapybara.configure(:firefox) do |c|
  # see below for a full list of configurations
  c.jslib_path = "next-version/axe.js"
end

# use the driver configuration instance
driver.page.navigate.to 'https://www.deque.com/'

API

AxeCapybaraの設定

configureメソッドは、symbolとしての1つのオプション引数と設定ブロックオブジェクトを受け取ります: configure(*arg, &block)

オプション引数はcapybaraのためのブラウザ名です。有効なブラウザ名は次の通りです:

  • :firefox (デフォルト)
  • :chrome
  • :safari
note

必要なドライバー(例えば、geckodriver)がマシンにインストールされていることを確認してください。

ブロック設定オブジェクトには、次のプロパティが含まれています:

プロパティ タイプ 説明
jslib_path (オプション) String カスタムaxeソースへのパス
skip_iframes (オプション) Boolean フレームがaxeで注入から除外されるかどうかを示す

設定ブロックには高度なAxeDevTools設定のためのパラメータも取ることができます