afcbpete
afcbpete

Reputation: 61

Is it possible to save an adobe pdf file using selenium web driver and one click build Jenkins

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

Answers (1)

Würgspaß
Würgspaß

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

Related Questions