title: How to avoid getting `'NoneType' object has no attribute 'path'` on selenium quit()?
body: <p>When running <em>Selenium Webdriver Python script,</em> one gets a <code>'NoneType' object has no attribute 'path'</code> after executing <code>self.driver.quit().</code> <br>Enclosing <code>self.driver.quit()</code> in <code>try/except</code> does not help, namely:</p>
  
  <pre><code>$ cat demo_NoneType_attribute_error.py
  # -*- coding: utf-8 -*-
  from selenium import webdriver
  import unittest
  
  class TestPass(unittest.TestCase):
      def setUp(self):
          self.driver = webdriver.Firefox()
  
      def test_pass(self):
          pass
  
      def tearDown(self):
          print("doing: self.driver.quit()")
          try:
              self.driver.quit()
          except AttributeError:
              pass
  
  if __name__ == "__main__":
      unittest.main()
  
  $ python demo_NoneType_attribute_error.py
  doing: self.driver.quit()
  'NoneType' object has no attribute 'path'
  .
  ----------------------------------------------------------------------
  Ran 1 test in 19.807s
  
  OK
  
  $
  </code></pre>
  
  <h2>Does anyone have an idea how to avoid the <code>'NoneType' object has no attribute 'path'</code> message?</h2>
  
  <p>Note:<br>
  Since this issue was already reported by the beginning of November (see URLs below), it should have had a patch by now - but upgrading <code>selenium</code> to latest from <code>pip</code> did not eliminate it.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/38574821/exception-attributeerror-nonetype-object-has-no-attribute-path-in">Exception AttributeError: &quot;&#39;NoneType&#39; object has no attribute &#39;path&#39;&quot; in</a></li>
  <li><a href="https://stackoverflow.com/questions/38574821/exception-attributeerror-nonetype-object-has-no-attribute-path-in">Exception AttributeError: &quot;&#39;NoneType&#39; object has no attribute &#39;path&#39;&quot; in</a></li>
  </ul>
  
  <p>Environment: Selenium 3.0.2; Python 2.7; Cygwin 32 bits on Windows 7.</p>