With this import statement I am importing both the Chrome driver (the browser) and ChromeOptions ( Options class). To enable editing the Chrome browser’s preferences require the import of the ChromeOptions class: from selenium.webdriver import Chrome, ChromeOptions The first thing you need to do is to change the default behavior of your Chrome browser so that it doesn’t automatically open the downloaded PDF in the browser window. Here are the essential items you need to configure your Selenium instance and Chrome browser to do the same. Once you’ve disabled the ability of Chrome to display and open the PDF file within its browser the last setting you would need to change is the location for where you want the file to be stored. The trick to be able to download a PDF file using Selenium without the Chrome browser opening the PDF file within the browser window is to set the preferences of the browser to simply not open PDF’s automatically. How do you download a PDF file when the URL opens up a PDF in your Chrome browser in Python without needing to print the page or use special key presses? And how can you set the location of the PDF?
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |