title: Selenium + Python + Chrome: simultaneously add_experimental_option and set desired_capabilities
body: <p>I am trying to change settings for Chrome driver so that it allows me to do both of the following:</p>
  
  <ol>
  <li>It doesn't give me a popup (<a href="https://stackoverflow.com/questions/45099288/what-is-pythons-equivalent-of-useautomationextension-for-selenium">as discussed here</a>).</li>
  <li>It allows me to change the download directory and settings (<a href="https://stackoverflow.com/questions/46937319/how-to-use-chrome-webdriver-in-selenium-to-download-files-in-python">as discussed here</a>).</li>
  </ol>
  
  <p>Although both the solutions work phenomenally in isolation, my attempts to combine them have failed disastrously. Below are the two isolated part solutions. Appreciate any help here.</p>
  
  <p>Code 1:</p>
  
  <pre><code>### This version save pdf automatically but has automation popup.
  
  from selenium import webdriver
  import time
  
  
  timestr = time.strftime("%Y%m")
  
  options = webdriver.ChromeOptions()
  
  prefs = {
  "download.default_directory": r"C:\temp\\"+timestr,
  "download.prompt_for_download": False,
  "download.directory_upgrade": True,
  "plugins.always_open_pdf_externally": True
  }
  
  options.add_experimental_option('prefs', prefs)
  driver = webdriver.Chrome(executable_path="C://temp//chromedriver.exe",options=options)
  driver.get("https://www.tutorialspoint.com/selenium/selenium_tutorial.pdf")
  </code></pre>
  
  <p>Code 2:</p>
  
  <pre><code>### This version has no automation popup but doesn't save pdf automatically.
  
  from selenium import webdriver
  import time
  
  
  timestr = time.strftime("%Y%m")
  
  capabilities = {
      'browserName': 'chrome',
      'chromeOptions':  {
          'useAutomationExtension': False,
          'forceDevToolsScreenshot': True,
          'args': ['--start-maximized', '--disable-infobars']
      }
  }    
  
  driver = webdriver.Chrome(executable_path="C://temp//chromedriver.exe",desired_capabilities=capabilities)
  driver.get("https://www.tutorialspoint.com/selenium/selenium_tutorial.pdf")
  </code></pre>