title: Testing JQuery autocomplete ui with cucumber
body: <p>I got this cucumber sceanario:</p>
  
  <pre><code>When I fill in "End User" with "john"
  Then wait
  Then wait
  When I click "John Doe"
  Then show me the page
  </code></pre>
  
  <p>Step definitions:</p>
  
  <pre><code>Then /^wait$/ do
    sleep 2
  end
  
  When /^(?:|I )click "([^"]*)"$/ do |selector|
    find(":contains('#{selector}')").click
  end
  </code></pre>
  
  <p>It passes but it doesn't select a user."End User" equals "john" in 'show me the page'.</p>
  
  <p>I even can't get it to work in a javascript console. The following code does not select anything.</p>
  
  <pre><code>$(":contains('John Doe')").last().trigger('click')
  # =&gt; [&lt;a class=​"ui-corner-all" tabindex=​"-1"...
  </code></pre>
  
  <p>How can I script a autocomplete select? Be it in pure javascript or in cucumber.</p>