title: Dropdowns work only after two clicks in Selenium web driver
body: <p>I am using Selenium with Python on the <a href="http://www.browserstack.com" rel="nofollow">Browserstack platform</a>.</p>
  
  <p>I am testing a <code>select2</code> dropdown, and I always need to click the dropdown twice to make it work:</p>
  
  <pre><code>dropdown_click = driver.find_element_by_css_selector('#s2id_autogen2 a.select2-choice')
  actions.click(dropdown_click).perform()
  actions.click(dropdown_click).perform()  # another click to open dropdown.
  driver.implicitly_wait(2)
  make_list = driver.find_element_by_id('select2-drop')
  assert make_list.is_displayed()
  </code></pre>
  
  <p>There's <code>implicitly_wait</code>, but without the second <code>click()</code>, the dropdown is still invisible and assertion fails.</p>
  
  <p>This is not the only JS dropdown that misbehaves this way for me in Selenium.</p>
  
  <p>This JavaScript code works correctly in browsers, but in Selenium it's correct only when clicked the first time. The second time I have to call <code>click()</code> twice.</p>
  
  <pre><code>$('span.opener').on('click', function() {
      $(this).next('.dropdown').toggleClass('dropdown-visible');
  })
  </code></pre>
  
  <p>What's wrong with Selenium and these dropdowns?</p>
  
  <p><strong>edit</strong>: explicit waits did fix this problem.</p>