Axe DevTools Watir

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-watir gemのセットアップとWatir WebDriverの使用方法

Not for use with personal data

このaxe-devtools-watirgemはWatirのためのチェイン可能なaxe APIを提供し、すべてのフレームに自動的に注入します。

セットアップと使用法

Deque's registryにアクセスできることを確認してください。もしできない場合は、setup documentationを参照してください。

以下の手順に従ってaxe-devtools-watirgemをセットアップしてください。

  • Gemfileにaxe-devtools-watirを追加します。

    gem "axe-devtools-watir"

    または、gemspecファイルに追加します。

    spec.add_dependency "axe-devtools-watir"

    gemをダウンロードしてインストールするにはbundle installを実行します。

  • gemをrequireして設定します。

require 'axe-watir' # Note that this shouldn't be 'axe-devtools-watir'

# configure `AxeWatir`
driver = AxeWatir.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/'
note

gemはaxe-devtools-watirと呼ばれていますが、requireを用いてaxe-watirとして参照する必要があります。

API

AxeWatir.configure

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

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

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

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

ブロック設定オブジェクトには次のプロパティがあります。

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

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