Downloading PDF using Selenium and Python in Chrome: Disabling PDF Viewer

Downloading PDF using Selenium and Python in Chrome: Disabling PDF Viewer

Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram:   / ky.emrah   Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!Downloading PDF using Selenium and Python in Chrome: Disabling PDF Viewer What I see currentlyI am trying to download a pdf after clicking on the button to do so but by default Chrome will use PDF Viewer. I have implemented the following code, which seems to stop the viewer from showing the PDF itself, but the frame of the viewer remains and a button exists in order to download. I am stuck because this button element does not show in the page source for Selenium to read. So I either need a solution to read this additional element or implement a better solution to disabling the PDF viewer completely. What I see currently options = webdriver.ChromeOptions() options.add_experimental_option('prefs', { "download.default_directory": "file_path", #Change default directory for downloads "download.prompt_for_download": False, "download.directory_upgrade": True, "plugins.always_open_pdf_externally": True #It will not show PDF directly in chrome }) wd = webdriver.Chrome(options=options) options = webdriver.ChromeOptions() options.add_experimental_option('prefs', { "download.default_directory": "file_path", #Change default directory for downloads "download.prompt_for_download": False, "download.directory_upgrade": True, "plugins.always_open_pdf_externally": True #It will not show PDF directly in chrome }) wd = webdriver.Chrome(options=options) enter image description here enter image description here I have tried this code. I need suggestions to fix. thank you Tags: python,google-chrome,selenium-webdriver,pdfSource of the question: https://stackoverflow.com/questions/7... Question and source license information: https://meta.stackexchange.com/help/l... https://stackoverflow.com/