2

I am using selenium to automate some downloading tasks, but some pages start the downloads automatically and I need to know the links of those downloads during or after the download and the link is not available in the page.

How can I get the URL of the files that started downloading automatically?

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179

1 Answers1

2

If you are using Chrome to run your selenium scripts you can just navigate to the chrome://downloads/ and get the latest download file's URL.

Or you can fire a Ctrl+J keyboard action to the browser using java robot classes and open the tab.

(Chrome downloads page is a html page and you can capture elements in it)

debugger89
  • 2,108
  • 2
  • 14
  • 16
  • The `chrome://downloads` changed and the page contains a lot of shadow root elements to work around that check this answer https://stackoverflow.com/questions/28911799/accessing-elements-in-the-shadow-dom/37250674#37250674 – Eduard Florinescu May 16 '16 at 14:22
  • I'm assuming that there is no way to do it and this is just a workaround, which is unfortunate. – Sridhar Sarnobat Oct 05 '22 at 04:32