def wait_to_appear(method, selector)
      seconds = 0
      while find(method, selector).nil?
        seconds += 0.2
        raise TimeoutException if seconds > timeout
        sleep 0.2
      end
    end
def wait_to_appear(method, selector)
      seconds = 0
      while find(method, selector).nil?
        seconds += 0.2
        raise TimeoutException if seconds > timeout
        sleep 0.2
      end
    end
If the browser is waiting for ajax or loading a page, Kanye is smart
 enough to deal with this.  However, if the browser is busy doing something
 else for a significant period of time (such as long-running JavaScript),
 Kanye is not smart enough to know that there is something that needs
 finishing.

 So basically, in the very rare cases that Kanye cannot detect that something
 needs to be waited for, you can explicitly wait for a DOM element to
 appear, for example:

   wait_to_appear(:css, '.ui-autocomplete.ui-menu')

 This will wait up to the poltergeist timeout value (which is probably
 30 seconds) for this DOM element to appear before moving on.  If the
 DOM element does not appear, an error is thrown.