title: CasperJS Send 'Enter' Keyboard Event to Submit Form Element
body: <p>I have written a simple Casper crawler for LinkedIn and I am currently trying to enter search parameters to the "Advanced Search" fields.</p>
  
  <p>You get get to the advanced search by logging in to LinkedIn, and pressing "Advanced" which is right of the search bar.</p>
  
  <p>The code which causes problems in related to <strong>sending an 'Enter' keyboard command to the input field to 'submit' it</strong>.</p>
  
  <pre><code>casper.waitForSelector('#srp_main_', function() {
  
    // Click on 'Current Company'
    this.click('li#adv-facet-CC legend.facet-toggle');
  
    // Click on 'Add' button
    this.click('#adv-facet-CC button.add-facet-button');
  
    this.then(function() {
  
      this.sendKeys('form#peopleSearchForm input[name=f_CC][type=text]', 'Facebook', {keepFocus: true});
  
      this.sendKeys('form#peopleSearchForm input[name=f_CC][type=text]', casper.page.event.key.Enter, {keepFocus: true});  
  
      this.capture('screenshots/added-search-parameters.png');   
    });
  });
  </code></pre>
  
  <p>Ideally what I would like to see is the company I am searching for to be added as an <code>input type=checkbox name=f_CC</code> element on the page like this</p>
  
  <p><a href="http://i.imgur.com/hHBP7FT.png" rel="nofollow">http://i.imgur.com/hHBP7FT.png</a></p>
  
  <p>I have tried doing a timeout, checking for eventListeners on the element, using <code>evaluate()</code> to simulate the keyboard event in the browser's console itself, and using <code>waitUntilVisible</code> for the autocomplete dropdown menu.</p>
  
  <p>Because I could have been doing those incorrectly, if a solution uses those approaches, please implement  it.</p>
  
  <p>So, how would one send an 'Enter' keyboard event to this particular LinkedIn input field.</p>
  
  <p>Edit: Output of <code>capture()</code> <a href="http://i.imgur.com/BC41qRP.png?1" rel="nofollow">http://i.imgur.com/BC41qRP.png?1</a></p>