Is it a must requirement to download on click or you can use urllib to fetch the source of pdf? Add a comment. Active Oldest Votes. Improve this answer. Jonnyboy Jonnyboy 9 9 bronze badges. DimpleMathew have edited the response to include python workaround — Jonnyboy. What error are you seeing? Can you update your question with what you have tried? Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. My script has to log into a site using a set of credentials, then navigate through some drop down menus to select a report.
Once the report is selected, a new window pops up where parameters must be adjusted to generate the report. Once the parameters are set, the same pop up window refreshes with the generated report in PDF format and is displayed using Chrome's built in PDF viewer. I was under the impression that passing certain options to the webdriver would disable this PDF viewer and simply download the file, but the PDF viewer is still being displayed and nothing is automatically downloaded.
Surely I'm missing something or I wrote something incorrectly. Here's the jist of my code:. Nothing is downloaded, so I'm wondering if I need to provide another line of code or perhaps something else. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Asked 2 years, 10 months ago. Active 1 year, 5 months ago. Viewed 20k times. Here's the jist of my code: from selenium import webdriver from selenium. Chrome driver. Using Selenium version 3. I had a similar problem, but, over in. Net - so I don't have a Python answer for you thus this comment , but in general you need to pass the following command to Chrome via Selenium: Page. Riley Hun Riley Hun 2, 4 4 gold badges 22 22 silver badges 51 51 bronze badges.
Take a look at this answer Add a comment. Active Oldest Votes. Try this code, it worked for me. ChromeOptions options. Kumar Kumar 2 2 silver badges 2 2 bronze badges. Thanks for the answer, helped a lot!
Hope it helps! Om Prakash Om Prakash 2, 3 3 gold badges 25 25 silver badges 46 46 bronze badges. Any idea why? It works with python3. I am sure, it will work for python 2 also. I'm also using python3. Even wget doesn't for aws links. I'm not sure how aws checks you whether you are in gui mode or not. Because I tested the code from your github page in headless chrome and it didn't work. Show 1 more comment.
0コメント