Reputation: 61
Here's my dilemma. I'm creating some automation tests using selenium web driver coding in Java. The main output of the software is to load a PDF in adobe acrobat.
I'm also using Jenkins which is why my problem has come about as I wont be able to physically see the output created by the software.
Is it possible to save this file in a certain location when the test has completed?
Upvotes: 2
Views: 2149
Reputation: 4840
This works with Firefox:
Change the Firefox profile used by Selenium (better to create a dedicated profile as described here) via Tools -> Settings -> Applications and change action of file type PDF to "Save file".
In that case the window asking to open file or save will not show up and the file is quietly saved to configured directory (Settings -> General -> Downloads).
Remember that you have to do that locally and in Jenkins as well. In both cases WebDriver has to be told to use this Firefox profile using environment variable -Dwebdriver.firefox.profile
on startup (if there is a custom profile otherwise default is used).
You can also set the profile programmatically. Here is an example in python and for CSV files but you should be able to transform that to Java and PDF.
Upvotes: 2