I know this question was probably answered already, but all the answers I found are either old and involve using Selenium APIs that are deprecated, or require a third-party tool, which is overkill for what I want to accomplish.

I need to download a PDF from a webpage, avoiding the Firefox "save as" pop-up window. I know it's possible by creating a new Firefox profile, but the documentation is extremely obscure on how to do it.

How do I create a Firefox profile using Selenium (Python 3.6 if possible, although I could fight my way through another language if there's a proper explanation) that allows me to download a PDF from a pop-up without needing to deal with the actual pop-up.

PS: I also tried using the Python module Requests, but was unsuccessful.

2 Answers 2


We use pdfminer, with urllib2. It does not fit your other criteria (is a third party library) and does process the URL opened by the popup, but is easy and straightforward to use. YMMV.

Next time you ask a question, you may want to mention what other approaches you tried and rejected (with reason) so people may have better idea what you are looking for, and provide better help (instead of guessing).


The easiest way to get this working is to search the dom for the anchor and get the href attribute. Once you have this, you can use this to directly download it to your file system. I am not a Python developer but with Java it is as simple as using Apache commons to copy a file from a URL to your filesystem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.