Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.7k points)

I've seen many posts regarding this but all of them in firefox, none of them helps with Chrome. I wanna get access to this download popup window:

enter image description here

Ideally, I'd like to set the download name from the script and then click the save button. But setting the chromedriver to ignore the download dialog and save the images automatically will work as well

Any help will be appreciated

1 Answer

0 votes
by (62.9k points)

I  don't think you will be able to accomplish this with a python selenium script. The download dialog box is rendered by the browser so you won't be able to target it with HTML.

Alternatively, you can turn off the "download dialog" option in settings that asks you where to save and have it save directly to a directory of your choice and then use python's os module in your script to rename the file.

So if you are saving some file to /tmp for example, then you could do the following in your script after the file has been downloaded:

os.rename("/tmp/my_downloaded_file", "/tmp/my_new_name") 

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing course!

Browse Categories