ruby - Capybara - unable to click a link -


i using capybara 2.4.4 click link. html this:

<a name="skiplink" id="skiplink" type="button" href="javascript:void(0);" onclick="skipform(); return false;">salta</a> 

capybara command:

find("a", :text => "salta").click find('skiplink').click 

none of both works:

failure/error: find("a", :text => "salta").click      nomethoderror:        undefined method `empty?' nil:nilclass 

i have copied-pasted html save_and_open_page output may correct

i using default driver (no selenium)

thanks

either of following should work

click_on('salta') find(:css, '#skiplink').click   # :css necessary if you've changed capybaras default selector 

your find("a", :text => "salta").click should work -- when using capybaras default driver (racktest) clicking on javascript links isn't going work since driver doesn't support javascript. need switch different driver (selenium, capybara-webkit, poltegeist, etc.) supports javascript


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -