title: How to quit all the Firefox processes which gets initiated through GeckoDriver and Selenium using Python
body: <p>I am using python 3.7 + selenium + geckodriver.exe + firefox 70.0.1x64,I know <code>driver.quit()</code> could close firefox window,but in some situation I can not quit firefox totally,I do not know why,this is my code:</p>
  
  <pre><code>from selenium import webdriver
  import time
  
  def func1():
      driver = webdriver.Firefox()
      i = 0
      while True:
          try:
              if i &gt; 10 and driver is not None:
                  driver.quit()
                  driver = None
                  print('quit success')
              i += 1
              print(i)
              time.sleep(1)
          except KeyboardInterrupt:
              if driver is not None:
                  driver.quit()
                  driver = None
                  print('keyboard quit success')
  
  if __name__ == '__main__':
      func1()
  </code></pre>
  
  <p>With this code,there are tow ways to close firefox window:</p>
  
  <p>1-wait 10 seconds.</p>
  
  <p>2-use Ctrl+C.</p>
  
  <p><strong>Then I test method 1</strong></p>
  
  <pre><code>python test1.py
  </code></pre>
  
  <p>When firefox winodw showed,I notice there are 6 process in task manager,like this
  <a href="https://i.stack.imgur.com/C091b.png" rel="noreferrer"><img src="https://i.stack.imgur.com/C091b.png" alt="enter image description here"></a></p>
  
  <p>Then I wait 10 seconds,everything is fine,6 process is gone,like this:</p>
  
  <p><a href="https://i.stack.imgur.com/c53tx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/c53tx.png" alt="enter image description here"></a></p>
  
  <p><strong>Then I test method 2</strong></p>
  
  <p>I press Ctrl+C in 10 seconds,result like this:</p>
  
  <p><a href="https://i.stack.imgur.com/tEUEB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tEUEB.png" alt="enter image description here"></a></p>
  
  <p>You can see that there are still 5 process alive,only 1 process is gone,I do not know why,Can anyone help me?Thanks a lot!</p>