title: Closing the webdriver instance automatically after the test failed
body: <p>My English is very poor but I'll try my best to describe the problem I encountered.</p>
  
  <p>I used selenium webdriver to test a web site and the language that I used to write my script is python.Because of this,I used Pyunit.</p>
  
  <p>I know that if my test suite have no exceptions,the webdriver instance will be closed correctly,(by the way, I used chrome) however,once a exception was threw,the script will be shut down and I have to close chrome manually.</p>
  
  <p>I wonder that how can I achieved that when a python process quits , any remaining open WebDriver instances will also be closed.</p>
  
  <p>By the way, I used Page Object Design Pattern,and the code below is a part of my script:</p>
  
  <pre><code>class personalcenter(unittest.TestCase):
  
      def setUp(self):
  
          self.driver = webdriver.Chrome()
          self.page = personalCenter(self.driver,"admin","123456")
  
      def testAddWorkExp(self):
  
          blahblahblah...
  
      def tearDown(self):
  
          self.page.quit()
          self.driver.quit()
  
  if __name__ == "__main__":
  
      unittest.main()
  </code></pre>
  
  <p>I haved searched the solution of this problem for a long time ,but almost every answer is depended on java and junit or testNG.How can I deal with this issue with Pyunit?</p>
  
  <p>Thanks for every answer.</p>