I would not use Selenium for this type of test and suggest that you solve a variety of testing issues with different tools. what we do is:
Use unit tests to test code: methods and classes
Integration tests to test how application components hang together
A Simple functional test framework like Canoo WebTest (or some equivalent) to assert things like Http cache headers, basic page structure, simple redirection and cookie setting / values
Bespoke tests to ensure validity of pages to W3C standards
JSunit to test Javascript classes and methods we created
Selenium to test UI functionality/behaviour and the integration of Javascript into those pages
Its worth spending time breaking out the responsibility of testing different aspects of the system using these different tools since using only Selenium can cause issues:
There are also some techniques - which you may or may not have come across - which you can use to make your Selenium tests more resilient.
Read the session cookies from Selenium and then use a real HTTP library outside of Selenium to request the specific page.
Here is the Python code:
# get session cookies from Selenium
cookies = {}
for s_cookie in self.selenium.get_cookies():
cookies[s_cookie["name"]]=s_cookie["value"]
# request the pdf using the cookies:
response = requests.get(self.full_url('/vms/business_unit/2002/operational_unit/200202/guest/40/bill/pdf/'), cookies = cookies)
self.assertEqual(response.headers["content-type"], "application/pdf")