I have scenario when I click on Submit , it open the PDF in the window i.e. in chrome pdf viewer and I want to download that pdf in the download directory path instead opening that in the new page
I tried below code -
${download_directory} Join Path ${OUTPUT DIR} downloads
Set Global Variable ${download_directory_guid} downloads
Create Directory ${download_directory}
Set Global Variable ${download_directory}
${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
# 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 ${download_directory} plugins.always_open_pdf_externally ${True}
${prefs} Create Dictionary download.default_directory=${download_directory} plugins.plugins_disabled=${disabled}
Call Method ${chrome options} add_experimental_option prefs ${prefs}
Call Method ${chrome_options} add_argument no-sandbox
Create Webdriver Chrome chrome_options=${chrome options}
maximize browser window
Go To http://mysite.com
I have tried with option plugins.always_open_pdf_externally ${True} and ${False}
Also tried this option -plugins.plugins_disabled=${disabled}
But pdf is still opened in chrome viewer.