1

I want to get the last downloaded file name to read it from java. I am working with selenium and need to get the last downloaded file name from chrome download list or from my download directory.

  • Do you need to extract the file name necessarily from the webbrowser? Since the test-'browser' launched by selenium is not a replica of your actual webbrowser and therefore will not contain the download list, this will be hard. If it works for you to get the filename from the users download directory, this would be far easier. – wittn Jul 20 '19 at 23:49
  • Check my answer [here](https://stackoverflow.com/questions/34548041/selenium-give-file-name-when-downloading/56570364#56570364) – supputuri Jul 21 '19 at 02:28
  • Possible duplicate of [Selenium give file name when downloading](https://stackoverflow.com/questions/34548041/selenium-give-file-name-when-downloading) – supputuri Jul 21 '19 at 02:30

1 Answers1

0

You can open downloads page in the new tab. The page is using shadow-root, so you have to do a little tricks to access the elements. Please, see the answer on this page, especially the JavaScript example. It will help you get around shadow-root and access the elements you need

Symph
  • 51
  • 8