0

How to get the file size of a downloaded file of specific name using the Selenium Web Driver ?? Please Help

  • 2
    Open a search engine and search for "how to get file size with Java". This is nothing Selenium-specific. – qqilihq Nov 19 '17 at 21:43
  • 1
    @Tirthankar it may be duplicated question. This is not related with selenium. You can take the help from the link [How to get file size](https://stackoverflow.com/questions/8721262/how-to-get-file-size-in-java) – Ali Azam Nov 19 '17 at 22:48

2 Answers2

0

You can try the following code:

URLConnection conn = url.openConnection();
long fileLength = conn.getContentLengthLong();
Jay Parmar
  • 500
  • 6
  • 22
0

In Java

you can do it with just two lines of code.

File file = new File("path//to//your//file.txt");
System.out.println(file.length());
Manmohan_singh
  • 1,766
  • 3
  • 20
  • 28