0

私のコードには非常に単純な DIV があります。

  <div class='articles'>
    <h2>More articles...</h2>
    <ul>
      <li><a href="/articles/where-to-take-your-driving-test-in-washington-state">Where to Take Your ...</a></li>
      <li><a href="/articles/crucial-topics-that-are-covered-in-the-dmv-handbook" >Crucial Topics that ...</a></li>

    </ul>
  </div>

そして、カピバラを使用して2つのLI要素をテストしようとしていますが、クラス内で検索していてカピバラに問題があるため、何も機能しません。

私はこれのすべてのバリエーションを試しました:

page.should have_css('.articles li', :count => "2")

また

page.first(:css, '.articles').should have_css('li', :count => 2)

IDではなくcssクラス内で検索できるようにする必要があるインスタンスがたくさんあるので、これを機能させる方法に興味があります

4

0 に答える 0