# How to verify PDFs with Selenium web driver

In our application, we upload PDF's into an interface. In this interface, the PDF is just a property of an object in a row that is displayed for the end user. The end user can see if a PDF has been uploaded for this row or not. Each PDF is unique to that row and must contain related data to the row's identity.

So my question is, is there a way to open the PDF in another tab, or download the PDF (by clicking on it) and then using the Selenium Web Driver to confirm/verify contents or if that it even exists?

We are using C#.

You can download the said PDF using Selenium webdriver, however I don't think you can verify the contents of the PDF, because that is not possible as far as I know using Selenium webdriver alone.

You can use Apache PDFBox to verify PDF contents- however it is a JAVA library. I am not sure whether you can combine PDFBox, along with Selenium and automate the whole process.

Use this code for C#

 FirefoxProfile profile = new FirefoxProfile();

Update the MIME/TYPE to be application/pdf since you are downloading a PDF file.