title: Wait for class to exist before continuing with selenium in Firefox
body: <p>I'm trying to make selenium wait until a certain class is able to be found on a page, I've tried several bits of code but nothing is working</p>
  
  <p>Trying the following:</p>
  
  <pre><code>while not firefox.find_element_by_css_selector('.but selected'):
      print "test"
      time.sleep(1)
  </code></pre>
  
  <p>Returns</p>
  
  <blockquote>
    <p>selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element</p>
  </blockquote>
  
  <p>Trying the following:</p>
  
  <pre><code>while not firefox.find_element_by_class_name('but selected'):
      print "test"
      time.sleep(1)
  </code></pre>
  
  <p>Returns:</p>
  
  <blockquote>
    <p>selenium.common.exceptions.InvalidSelectorException: Message: The given selector but selected is either invalid or does not result in a WebElement. The following error occurred:
    InvalidSelectorError: Compound class names not permitted</p>
  </blockquote>
  
  <p>Any idea what I am doing wrong and how to fix it?</p>