title: Capybara RSpec Not Finding and Clicking CSS Element
body: <p>I am writing a test suite for a Rails code base of mine and am trying to click on a search icon using Capybara and check if the search field appears. However, the test keeps failing as Capybara cannot find the CSS element "search_icon". I have tried using <code>click_on()</code> and <code>find(CSS).click</code>, but neither work. The former returns the error </p>
  
  <blockquote>
    <p>1) Contents search clicking magnifying glass makes search box appear
         Failure/Error: click_on('search_icon')
         Capybara::ElementNotFound:
           Unable to find link or button "search_icon"
         # ./spec/features/contents/contents_search_spec.rb:13:in `block (2 levels) in '</p>
  </blockquote>
  
  <p>and the latter returns</p>
  
  <blockquote>
    <p>1) Contents search clicking magnifying glass makes search box appear
         Failure/Error: find('#search_icon').click
         Capybara::ElementNotFound:
           Unable to find css "#search_icon"
         # ./spec/features/contents/contents_search_spec.rb:13:in `block (2 levels) in '</p>
  </blockquote>
  
  <p>This is the RSpec desription</p>
  
  <pre><code>scenario "clicking magnifying glass makes search box appear" do
    visit contents_path
  
    find("#search_icon").click
  
    #Also tried this:
    #click_on('search_icon')
  
    expect(find("#search-form").visible?).to be true
  end
  </code></pre>
  
  <p>that attempts to find this element</p>
  
  <pre><code>&lt;div class="pull-right has-tooltip" data-title="Search" id="search_icon" data-original-title="" title=""&gt;
  
  &lt;i class="glyphicons-icon search"&gt;&lt;/i&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Is there an issue with my RSpec scenario code or how else could I find and click on this element?</p>