I am currently using the following code where ${BASE_URL} is my system under test and ${BROWSER} value is set to chrome. I have followed the solution provided on the thread: click here
But somehow disabling the Chrome PDF Viewer is not working. I am still seeing PDFs are being opened in new tab instead of downloaded to local directory.
*** Settings ***
Documentation Common setup and teardown steps
Library SeleniumLibrary
Resource UtilManager.robot
*** Keywords ***
Begin Test
[Arguments] ${BROWSER} ${BASE_URL}
@{workingDirs} UtilManager.Get Current Working Directories
${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
log ${chrome_options}
# list of plugins to disable. disabling PDF Viewer is necessary so that PDFs are saved rather than displayed
${disabled} create list Chrome PDF Viewer
${prefs} create dictionary download.default_directory=${workingDirs}[1] plugins.plugins_disabled=${disabled}
call method ${chrome options} add_experimental_option prefs ${prefs}
create webdriver ${BROWSER} chrome_options=${chrome options}
go to ${BASE_URL}
maximize browser window