ruby on rails - Capybara and nested divs with repetitive text -
i trying test section heading cucumber , capybara. word practice. problem practice used on page multiple times having problems ambiguous matches. word nested within many divs rather stuck. relevant part of code follows:
<li class="section"> <div class="section"> <div class="section-heading" data-tracking-label="lesson menu > section heading"> <div class="indicator"> <div class="icon"> <div class="glyph"></div> </div> </div> <div class="name">practice</div> </div>
use following syntax:
# within syntax best when have ambiguous matches within(".section-heading")do find('.name', :text => 'practice').click end
Comments
Post a Comment