To change the download directory in Chrome, you must pass experimental options to the Open Browser keyword. This tells the Chrome driver to override the default system path.
The method depends on whether you are using the standard or the newer Browser Library (Playwright-based). 1. Using SeleniumLibrary (Chrome) set download directory in robot framework
Firefox requires setting preferences within a profile. You can do this directly in the Open Browser keyword using the ff_profile_dir argument to set specific key-value pairs. To change the download directory in Chrome, you
*** Test Cases *** Set Download Folder In Firefox ${prefs}= Set Variable set_preference("browser.download.dir", r"${DOWNLOAD_PATH}");set_preference("browser.download.folderList", 2);set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf") Open Browser https://your-site.com firefox ff_profile_dir=${prefs} Use code with caution. *** Test Cases *** Set Download Folder In
*** Settings *** Library SeleniumLibrary Library OperatingSystem *** Variables *** ${DOWNLOAD_PATH} ${CURDIR}${/}downloads *** Test Cases *** Set Download Folder In Chrome [Setup] Create Directory ${DOWNLOAD_PATH} ${prefs} Create Dictionary download.default_directory=${DOWNLOAD_PATH} Open Browser https://your-site.com chrome options=add_experimental_option("prefs", ${prefs}) Click Element id=download-button Wait Until Keyword Succeeds 30s 2s File Should Exist ${DOWNLOAD_PATH}/expected_file.csv [Teardown] Close Browser Use code with caution.