title: webdriver wait for ajax request in python
body: <p>Currently I am writing webdriver test for search which uses ajax for suggestions. Test works well if I add explicit wait after typing the search content and before pressing enter.</p>
  
  <pre><code>wd.find_element_by_xpath("//div[@class='searchbox']/input").send_keys("obama")
  time.sleep(2)
  wd.find_element_by_xpath("//div[@class='searchbox']/input").send_keys(Keys.RETURN)
  </code></pre>
  
  <p>but</p>
  
  <pre><code>wd.find_element_by_xpath("//div[@class='searchbox']/input").send_keys("obama")
  wd.find_element_by_xpath("//div[@class='searchbox']/input").send_keys(Keys.RETURN)
  </code></pre>
  
  <p>fails. I am running tests on ec2 with 1 virtual cpu. I am suspecting, I pressed enter even before GET requests related to search are sent and if I press enter before suggestions, it fails.</p>
  
  <p>Is there any better way that adding explicit waits?</p>