Selenium Python Chromedriver Change File Download Path
<p>I'm looking for a way to save different files to different locations in python using chromedriver. The code below sets chrome to download to folder_path without pop the download location dialogue first. 
After clicking and downloading one file into folder_path (I skipped pasting this part of code cause I have no issue), I want to download another file into new_folder_path. But the code below gives me AttributeError: 'WebDriver' object has no attribute 'Chrome'. Any ideas if I can change download location for Chrome under the same webdriver?</p>

<pre><code>folder_path = "C:\\Document"

def give_chrome_option(folder_path):
    chromeOptions = webdriver.ChromeOptions() #setup chrome option
    prefs = {"download.default_directory" : folder_path,
           "download.prompt_for_download": False,
           "download.directory_upgrade": True}  #set path
    chromeOptions.add_experimental_option("prefs", prefs) #set option
    return chromeOptions
driver = webdriver.Chrome(chrome_options = give_chrome_option(folder_path)
driver.get(sample_url)
driver.Chrome(chrome_options = give_chrome_option(new_folder_path))
</code></pre>

<p>No, you have to re-instantiate WebDriver if you want to download to a different directory. Depending on what exactly do you need to do, a workaround described in the first answer <a href="http://stackoverflow.com/a/23897531/1733471">here</a> might be suitable for you (download to a temporary directory then move file using <code>os.rename()</code>)</p>

python google-chrome selenium download selenium-chromedriver