How to get the file size of a downloaded file of specific name using the Selenium Web Driver ?? Please Help
Asked
Active
Viewed 2,337 times
0
-
2Open 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 Answers
0
You can try the following code:
URLConnection conn = url.openConnection();
long fileLength = conn.getContentLengthLong();

Jayveer Parmar
- 500
- 7
- 25
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,776
- 3
- 20
- 29