You can't with Selenium,
The browser dialogue is an OS level dialogue, Selenium can't
interact with these. The best you could hope for is clicking on a
print link and having the dialogue pop open and then take a
screenshot (as suggested previously) that you will need to check
manually to ensure it is there (Not really an automated solution).
One other potential solution would be to use a java robot class to
interact with the print dialogue, but thn you would need to know
where it appears and if it didn't appear you probably wouldn't know
anyway.
I guess the question is why are you doing this test? I can
guarantee that printing from browsers works if you have a valid
print driver, this is something the browser manufacturers will
test. Why do you need to test it as well?
- What would you do if your test failed?
- Can you fix and patch the issue and get the code integrated
into the next release of the browser that is causing problems?
- If you can do the above can you force your users to use a
specific version of the browser that has your fix?
If the answer to the above questions is don't know and no then you
are wasting your time.