Capybara failed to find position for element

Viewed 1022

I'm using Capybara with a webkit driver and when I'm running tests with js: true it raises error listed below. When I do same things in other tests without js: true everything works fine.

PS. There is no need for js :true in this test. This code is actually inside a helper but I put it here like test , so it will be easier to understand.I'm using js: true in the other test that invokes this helper method.

Code below raises Capybara::Webkit::ClickFailed: Failed to find position for element /html/body/div/div/div/div[2]/a[12]

scenario "adding logged days", js: true do
visit '/logged_days'

find(:xpath, "//a[contains(.,'12')]").click
# click_link("12") raises same error

expect(current_path).to eq("/logged_days/new")


fill_in "Опис виконаної роботи", with: "Some description"
fill_in "Кількість відпрацьованих годин", with: 40

click_button "Додати"

expect(current_path).to eq("/logged_days")
expect(page).to have_content("40")

end

/logged_days:

   <div class="page-header">
    <h2>Logged Days <small>March</small></h2>
   </div>
   <div class="conteiner-fluid logged_days_container">
    <% for i in 1..31 %>
     <%= link_to new_logged_day_path(:cal_date => "#{i}"), method: :get do %>
      <div class="calendar_cell">
        <p class="cell_date"><%= i %></p>
        <p class= "cell_text"></p>
      </div>
    <% end %>
   <% end %>
</div>
2 Answers
Related