Testing PDF downloads with Sauce Labs

There are 2 main challenges to testing PDF downloads with Sauce Labs:

1. Testing PDFs in the browser are not supported by Selenium.
2. Download dialogs are native UI elements and not supported by Selenium.

A PDF file may try to open in a PDF plugin, which cannot be accessed by Selenium. But, even if you change your browser configuration to download PDF files automatically, as described here:

http://elementalselenium.com/tips/2-download-a-file

Sauce Labs does not provide access to the file system on our VMs. So, in order to test a PDF you would need to download it locally. The best practice is to get the URL of the link using Selenium and then to download it using wget, curl, or your favorite HTTP library.

See this blog post which goes into further detail:

http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/