title: Rename downloaded files selenium
body: <p>I'm using selenium to automatically download files in csv format from this page:</p>
  
  <p><a href="https://catalog.data.gov/dataset?tags=crime" rel="noreferrer">https://catalog.data.gov/dataset?tags=crime</a></p>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>profile = webdriver.FirefoxProfile()
  profile.set_preference("browser.download.folderList", 2)
  profile.set_preference("browser.download.manager.showWhenStarting", False)
  profile.set_preference("browser.download.dir", '/home/luis/Desktop/data/')
  profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/csv")
  
  driver = webdriver.Firefox(firefox_profile=profile)
  driver.get(url)
  time.sleep(2)
  download_button = driver.find_element_by_xpath('//*[@id="content"]/div[2]/div[2]/section[1]/div[2]/ul/li[14]/div/ul/li[1]/a')
  download_button.click()
  </code></pre>
  
  <p>Here the download folder is set:</p>
  
  <pre><code>profile.set_preference("browser.download.dir", '/home/luis/Desktop/data/')
  </code></pre>
  
  <p>How can I select the name with which the file is saved?
  Can be the name defined at the moment of the download?</p>
  
  <p>I meant something like this:</p>
  
  <pre><code>For name in names:
      download_button = driver.find_element_by_xpath('//*[@id="content"]/div[2]/div[2]/section[1]/div[2]/ul/li[14]/div/ul/li[{}]/a'.format(name))
      download_button.click()
      save_file_as(name)
  </code></pre>