Rails + Capybara: How do I loop through all links with certain text? -
i have bunch of anchor tags text delete image. how loop through of them , click them 1 one? use ajax. doesn't work:
when(/^i delete section images$/) page.all(:link, "delete image").each |link| click_link(link) page.driver.browser.switch_to.alert.accept end sleep 1 end
when(/^i delete section images$/) all(:link, "delete image").each |link| link.click page.driver.browser.switch_to.alert.accept end sleep 1 end the link parameter passed loop instance of capybara class can respond #click. click_link("text") works on matching text.
Comments
Post a Comment