Downloading PDF content in iframe with source url not having .pdf extentions

I am trying to download pdf file that is generated dynamically using python.

Inspect element iframe looks something like this.

name="detail" src="/service/displayMailStream.a?importSummaryId=513221314664&lang=en&OWASP_CSRFTOKEN=ZjI2ZTU3MTYt313123MzVhNS0xMWViLWIwNjktMDA1MDU2ODYzZDU0#navpanes=0&toolbar=1&view=fitH" frameborder="0"

The Actual URL when opening the link which has PDF content is:
https://www.postal.com/service/displayEpostInboxMail.a?documentId=51121213314664&language=en&source=myinbox&OWASP_CSRF=ZjI2ZTU3MT321312312YtMzVhNS0xMWViLWIwNjktMDA1MDU2ODYzZDU0

The pdf viewer plugin has the download button which can be clicked and pdf will be downloaded.

However is there a way for chrome to download the pdf immediately after the url is opened (Chrome PDF download automatically is set to Yes but this requires the download button to be clicked)

Additionally:
I could try to click the download button via selenium but the button cannot be accessed by ID.
Because the button is under #Document == $0.

Any one have this working ?

Source: Ask Javascript Questions

LEAVE A COMMENT