Unable to download PDFs automatically - Insufficient Permissions msg

272 views
Skip to first unread message

Alex G

unread,
Apr 17, 2018, 10:20:42 AM4/17/18
to robotframework-users
Hello all. I've got a problem that I've had no luck finding a solution for. I'm trying to setup Chrome so that it will download all files automatically to a directory of my choosing. It seems to work for all file types except PDFs. I do not have any plugins/extensions installed. I have proper permissions to the folder I'm downloading to (other file types download without an issue).

I've setup some keywords to open Chrome with certain options/prefs. I have a Python keyword as follows:

def set_chrome_options(dldir):
    """ Sets specific Chrome Options to pass to Robot. See in-line comments for more. """

    options = webdriver.ChromeOptions()
    options.add_argument("--start-maximized")  # Starts the window maximized
    options.add_argument("--disable-infobars")  # Does not show the infobar about automated software running
    options.add_experimental_option("prefs", {
        "download.default_directory": dldir,  # Sets download directory based on argument given
        "download.prompt_for_download": False,  # Sets downloads to NOT prompt, will save to above directory
        "download.directory_upgrade": True  # Needed to make the above 2 work correctly
    })
    options.add_experimental_option("useAutomationExtension", False)  # Gets around the extension policy error pop up
    return options

Then I have a RF keyword as follows:

Open Chrome Browser
    [Documentation]    Open an instance of Chrome using options defined in our Python keyword 'Set Chrome Options'.
    [Arguments]    ${url}    ${dldir}
    ${chrome_options}=    Set Chrome Options    ${dldir}
    Create Webdriver    Chrome    chrome_options=${chrome_options}
    Goto    ${url}

This all works great, but when it tries to download PDF files from the site I'm testing, I get an error:  
"Failed - Insufficient Permissions"



If I go in manually, the downloads work fine. It's only when running with these options defined. Any ideas?
Reply all
Reply to author
Forward
0 new messages