Closed ractoc closed 5 years ago
I think it works fine for me, expect the default download dir, which might relate to SeleniumHQ/selenium#5292
Now I got this to work with Windows. I think it's matter of escaping things, and because of that some more logic is needed if tests are running with both Linux and Windows.
Working Chrome part is:
Download automatically
WebDriver Manager Setup Chrome
${downloadDir} Replace String ${OUTPUT_DIR}${/}${download} \\ \\\\
Log ${downloadDir}
${browserOptions}= Catenate
... {
... "args": [ ],
... "extensions": [ ],
... "prefs":
... {
... "plugins.always_open_pdf_externally": true
... "download": {
... "default_directory": "${downloadDir}",
... "prompt_for_download": false
... }
... }
... }
Log ${browserOptions}
Open Browser ${URL} Chrome browserOptions=${browserOptions}
Capture Page Screenshot #Needed because otherwise incomplete download is made. Basically any browser command probably would be OK.
So no changes needed to the library itself I think.
Currently I'm having some problems setting the experimental options. In Python, everything works fine (through the Create Webdriver keyword). When I try and do the same for the Java variant, I'm not getting the same results. I am setting the same prefs.
I put both the Python version and the Java version here for reference. What I do is, I cal leither of these to open a Chrome browser. Then I browse to a URL containing a PDF document. With the Python settings, the PDF is downloaded directly, to the folder I set in prefs. With the Java variant, the download popup shows using the default download folder.
I already tweaked the BrowserManagement class in the library to convert the prefs JSONObject to a Java Map. This didn't fix the issue. It looks like only the one prefs property is honered through Java for some reason.