I noticed that your screenshot about The inspect section of the modal view .
The element has an attribute original_url
which is the original url of the pdf file.
And reference to this answer, you can try to directly download the pdf file by configurating webdriver.ChromeOptions()
.
So in your case it can be like this:
from selenium import webdriver
profile = {
'download.prompt_for_download': False,
'download.default_directory': '/path/to/download/the/pdf',
'download.directory_upgrade': True,
'plugins.always_open_pdf_externally': True,
}
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', profile)
driver = webdriver.Chrome(options=options)
driver.get('your_url')
# Your code to handle the Captcha
# When you open the modal dialog box
pdf_url = driver.find_element("id", "plugin").get_attribute("original_url")
driver.get(pdf_url)
# Chrome will download the PDF automatically