Rails + Cucumber + Selenium: How to click on a span inside a ul and li? -
i trying write tests clicking around on mobile site. however, i'm having trouble finding documentation on how click embedded non link elements. html:
form id="search-results-form" action="" method="post"> <div> <ul id="see-more-search" class="see-more" style="display: block; height: auto;"> <li> <span>color</span> </li> <li> <span>width</span> </li> </ul> </div> ...
this incomplete cucumber test:
when(/^touch "color"$/) within(:css, '#see-more-search') #i want able click span text 'color', #don't know how target point end end
does know how target first li
or 'color' span?
try using javascript:
page.driver.browser.execute_script %q{ $('#see-more-search ul li:first').trigger("mouseenter").click(); }
Comments
Post a Comment