I have been trying to fix this error for a very long time, and I cannot understand what it is. Thanks in advance for your help!
I am writing tests for a rails application with capybara and rspec trying to click an element in the navigation bar and then check that the page is correct, but it seems that no matter how I tell capybara to click the element, it cannot find it.
... subject { page } describe 'when clicking Home link', :js do before do visit some_path find('a', text: "Home").click end it { should have_selector('title', text: 'bla bla bla') } end ...
I have tried many different versions of this code, including
click_link('Home'), click_on('Home'), find('a.header-link.header-link-home', text: 'Home').click, find_link(...).click, click_button(...)
etc., as well as with and without: js and in different "inside" operations, but I always get Capybara :: ElementNotFound: Unable to find css "a". I also tried to increase the default timeout of capybara to 5 seconds.
This is the element I'm trying to click (according to the source code of the page)
<a class="header-link header-link-home" href="/">Home</a>
Gem versions: capybara (1.1.4), rspec (2.12.0)
Thank you, ton, I really appreciate it!