title: How do I automatically download files from a pop up dialog using selenium-python
body: <p>I am trying to automatically download files from a pop up dialog using selenium-python.</p>
  
  <p>The firefox popups look like this </p>
  
  <p><img src="https://i.stack.imgur.com/zCDgJ.png" alt="enter image description here"></p>
  
  <p>I want to simulate clicking "OK"</p>
  
  <p>I found this answer <a href="https://stackoverflow.com/questions/8959778/how-do-i-trap-a-popup-in-selenium-2-python">How do I trap a popup in Selenium 2 python</a> which sent me to the docs <a href="https://selenium-python.readthedocs.org/en/latest/navigating.html?highlight=popup#popup-dialogs" rel="noreferrer">https://selenium-python.readthedocs.org/en/latest/navigating.html?highlight=popup#popup-dialogs</a></p>
  
  <p>I've tried this</p>
  
  <pre><code>    alert = driver.switch_to_alert()
      #alert.send_keys(Keys.RETURN) #No alert is present
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>    alert = driver.switch_to_alert()
      alert.accept()  #no alert is present
  </code></pre>
  
  <p>If I run <code>pprint.pprint(driver.window_handles)</code> it prints only a single GUID -- showing that only one window is present. </p>
  
  <p>So if no alert is present and there is only one window -- how do I download these files?</p>