Dropdown select in Capybara with no id? -
so have few dropdowns im making automated test cases (just checking make sure links work , go right location. easy test cases toss in there)
but don't have id's or work with:
here outer html of dropdown text click (which reveals more dropdowns).
<a href="#" data-toggle="dropdown"><i class="glyphicon glyphicon-list-alt"></i> main dropdown <b class="caret"></b></a>
the rest of items listed this:
<li><a href="/quotes"><i class="glyphicon glyphicon-list"></i> option 1</a></li>
would make more sense try use clickable text click on "main dropdown" text , clickable text click on "option 1" (names changed concept still same).
since that's html in there?
capybaras link finder finds link elements id, text, title or contained images alt attribute. html provided best best text - so
click_link('main dropdown') # open dropdown click_link('option 1') # wait link become visible , click
Comments
Post a Comment