title: Saving embedded .pdf not as .pdf file
body: <p>I'm trying to download a embedded pdf from the chrome browser with below code, however the file is being stored on my C:\ drive as a the following file: <code>C:\TEST_A_15.pdf.crdownload</code>.</p>
  
  <pre><code>def download_pdf(lnk):
  
      from selenium import webdriver
      from time import sleep
  
      options = webdriver.ChromeOptions()
  
      download_folder = "C:\\"
  
      profile = {"plugins.plugins_list": [{"enabled": False,
                                       "name": "Chrome PDF Viewer"}],
             "download.default_directory": download_folder,
             "download.extensions_to_open": ""}
  
      options.add_experimental_option("prefs", profile)
  
      print("Downloading file from link: {}".format(lnk))
  
      driver = webdriver.Chrome(chrome_options = options)
      driver.get(lnk)
      filename = lnk.split("=")[3]
      print("File: {}".format(filename))
  
      print("Status: Download Complete.")
      print("Folder: {}".format(download_folder))
  
      driver.close()
  </code></pre>
  
  <p>If I adjust the line for <code>filename</code> to what's below, then I get the <code>C:\TEST_A_15.pdf</code> file desired on my harddrive without the <code>.crdownload</code> at the end. But then I get a <code>IndexError: list index out of range</code> which is logical because the <code>"="</code> is not be found in position 4.</p>
  
  <pre><code>    filename = lnk.split("=")[4]
  </code></pre>
  
  <p>The URL used (I changed the hostname and name of pdf file so URL don't work):
  <code>https://testing.nl/getpdf.asp?id=ORsP5UqX6IikuikcGiLD&amp;unique=adda3b24-f9ca-4007-898a-caed5309c140&amp;filename=TEST_A_15.pdf</code></p>
  
  <p>Even more strange when I use a network drive together with the <code>filename = lnk.split("=")[3]</code> then the file will be stored as a .tmp file i.e.: <code>2498d715-84aa-4e81-8037-264bb0211b4b.tmp</code> and when I use the incorrect code (<code>filename = lnk.split("=")[4]</code>) it gives the <code>IndexError</code> but saves the file correctly as .pdf file on the network drive.</p>