title: Closing all the opened chrome windows using selenium - python - osx
body: <p>I have to download some files from a website, I'm using Python - Selenium - Chrome - Osx.</p>
  
  <p>I have his code so far:</p>
  
  <pre><code>lnk = "www.foobar.com"
  CHROMEDRIVER=webdriver.Chrome()
  options = webdriver.ChromeOptions()
  profile = {"plugins.plugins_list": [{"enabled":False, "name":"Chrome PDF Viewer"}],
          "download.default_directory" : TEMP_DOWNLOAD}
  options.add_experimental_option("prefs",profile)
  driver = webdriver.Chrome(chrome_options = options)
  driver.get(lnk)
  while True:
      if filter(os.path.isfile, glob.glob(TEMP_DOWNLOAD+'/*.crdownload')):
          pass
      else:
          break
  driver.quit()
  </code></pre>
  
  <p>This code starts the download of the file, waits the end of the download and then closes the webdriver.</p>
  
  <p>Everything is working properly except that it opens 2 Chrome windows, one to open the link and the other to download the file, and the quit() method closes only the latter.</p>
  
  <p>Is there a way to kill all the windows opened by Selenium (I'm trying to avoid firing a terminal command to kill the processes brute force)?</p>
  
  <p>EDIT:</p>
  
  <p>as Mukesh Takhtani said in comment in my code the problem is a pointless webdriver instance.</p>