<p>It seems that the default configuration of chrome is to disable the download for security reasons. You may change this in the options. I am attaching a working example based on <a href="https://arxiv.org/" rel="nofollow noreferrer">Arxiv</a> which has safe pdf downloads:</p>
<pre><code>options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {
&quot;download.default_directory&quot;: os.path.join(os.getcwd(),&quot;Downloads&quot;), #Set directory to save your downloaded files.
&quot;download.prompt_for_download&quot;: False, #Downloads the file without confirmation.
&quot;download.directory_upgrade&quot;: True,
&quot;plugins.always_open_pdf_externally&quot;: True #Disable PDF opening.
})

driver = webdriver.Chrome(os.path.join(os.getcwd(),&quot;Downloads&quot;,&quot;chromedriver&quot;),options=options) #Replace with correct path to your chromedriver executable.


driver.get(&quot;https://arxiv.org/list/hep-lat/1902&quot;) #Base url


driver.find_elements(By.XPATH,&quot;/html/body/div[5]/div/dl/dt[1]/span/a[2]&quot;)[0].click() #Clicks the link that would normally open the PDF, now download. Change to fit your needs
</code></pre>
Selenium Python, How can I download a PDF to a specific location without having the "url"
<p>I've been writing a code with python using Selenium that should access a webpage and download a pdf. But, when the driver clicks on the button it generates a new tab with the pdf, and I can't use that URL to download the PDF.
Can anyone help me, please?</p>
<p>(example: if I ask my driver to &quot;get&quot; the PDF &quot;URL&quot;, the driver opens the page I was before, the one it had the button that opens the PDF Chrome previewer)</p>
<p>If the problem seems understandable please inform me so I can try to explain it better.</p>