title: Downloading with chrome headless and selenium
body: <p>I'm using python-selenium and Chrome 59 and trying to automate a simple download sequence. When I launch the browser normally, the download works, but when I do so in headless mode, the download doesn't work.</p>
  
  <pre><code># Headless implementation
  from selenium import webdriver
  
  chromeOptions = webdriver.ChromeOptions()
  chromeOptions.add_argument("headless")
  
  driver = webdriver.Chrome(chrome_options=chromeOptions)
  
  driver.get('https://www.mockaroo.com/')
  driver.find_element_by_id('download').click()
  # ^^^ Download doesn't start
  </code></pre>
  
  <hr>
  
  <pre><code># Normal Mode
  from selenium import webdriver
  
  driver = webdriver.Chrome()
  
  driver.get('https://www.mockaroo.com/')
  driver.find_element_by_id('download').click()
  # ^^^ Download works normally
  </code></pre>
  
  <hr>
  
  <p>I've even tried adding a default path:</p>
  
  <pre><code>prefs = {"download.default_directory" : "/Users/Chetan/Desktop/"}
  chromeOptions.add_argument("headless")
  chromeOptions.add_experimental_option("prefs",prefs)
  </code></pre>
  
  <p>Adding a default path works in the normal implementation, but the same problem persists in the headless version.</p>
  
  <p>How do I get the download to start in headless mode?</p>