Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Capybara | 検証対象のScopeを指定

概要

検証対象のScopeを指定

内容

検証対象のScopeを指定します。
例えばh1タグの中にある文字列を取得する場合

within("h1") do
  puts page.text
end

のようにします。