I am working on an automation project and I am trying to download a pdf from a website. The website only contains the pdf but the file type of the webpage is HTML. The pdf is displayed using PDF.js and the PDF.js viewer is also in an iframe.
When I tried to click the element using browser javascript, i was returned with a security error relating to cross site scripting.
SecurityError: Permission denied to access property "document" on cross-origin object
I would like to download the pdf from my script, written in python, using selenium. When I try this:
driver.find_element_by_id('download').click()
No results are produced, the download button doesn't get clicked even though I have switched focus to the iframe in selenium.
Does anybody know a solution how to download the pdf?