How to control the download of files with Selenium + Python bindings in Chrome
<p>Where can I find the documentation that describes the options I can use with Selenium and Chrome web browser? I want to open a link in a web browser (to get credential) but not to download the corresponding file (.pdf or .tiff or .jpeg). I am using Python 2.7, selenium 3.0.1 and Chrome version 54.0.2840.99 (and chromedriver.exe) on Windows 7 Laptop.</p>

<pre><code># Chrome web browser.
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')  
#options.add_argument('--disable-download-notification') #doesn't seems to work 
#options.add_experimental_option("prefs", {"download.default_directory","C:\Users\xxx\downloads\Test"}) # doesn't work
#options.add_experimental_option("prefs", {"download.prompt_for_download": False}) # doesn't seems to work
#options.add_experimental_option("prefs", {'profile.default_content_settings': {'images': 2}})# this will disable image loading in the browser
options.add_argument("user-agent="+user_agent_profile)
driver_main = webdriver.Chrome(chrome_options=options)

# Opening the web application portail.
driver_main.get("https://my_link")
</code></pre>

<p>I found many discussions on this topic but none of the solution works. For example:</p>

<pre><code>add_experimental_option("prefs", {"download.default_directory","C:\Users\xxx\downloads\Test"})
</code></pre>

<p>doesn't work for me.</p>

<p>Same for:</p>

<pre><code>add_experimental_option("prefs", {"download.prompt_for_download": False})
</code></pre>

<p>(I also try with "false").</p>

<p>While:</p>

<pre><code>add_argument("user-agent="+user_agent_profile)
</code></pre>

<p>Seems to work!</p>

<p>I am not sure to understand what is wrong</p>

<p>The issue I got is that, it starts to download the file each time I open a link with name file(1) file(2) .... file(99) then starting at 100 it opens a popup window "Save As". So I would like to either don't download the file at all or be able to move it in a specific folder in the "Recycle Bin".</p>

<p>How do I find which options could be I used with add_argument and add_argument? I tried to look at Chrome://about/ but I couldn't see a direct correspondence.</p>

<p>Thanks a lot.</p>

<p>Cheers.</p>

<p>Fabien.</p>