xpath - click on a image link with Capybara -


i trying click on image link capybara / rspec test. having little success @ moment.

i trying select link href "/post/3", (knowing other links before). have tried many combinations of xpath without success. combination working

page.first(:xpath, //a).click 

however when have changed file , added more links above capybara test broken.

   <div class='row'>   <a href="/posts/3"><img id="imagen3" src="/system/posts/images/000/000/003/original/frankie-mannings-102nd-birthday-5160522641047552-hp.gif?1464448829" alt="frankie mannings 102nd birthday 5160522641047552 hp" /></a>   <p>caption</p> </div> 

how can select link, , click it?

ok got it: find(:xpath, "//a[contains(@href,'posts/3}')]").click


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -