How to Validate Downloaded file after clicking on downloaded button/ link in chrome browser
closed as unclear what you're asking by IAmMilinPatel, Niels van Reijmersdal, NarendraC, Paul Muir, Rsf Aug 16 '16 at 13:30
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
It is unclear what do you mean by "Validate". If you are downloading a document and your target is to check its content the question is not related to Selenium as Selenium is browser automation framework.
See Examples section to get started with Tika.
If you're using a different client language search for similar libraries to parse downloaded file and extract its content.
- Create a digital signature of a valid file
- After download get the signature of downloaded file
- Compare the signatures. If they are the same the download is valid.
You can use the MD5 command line tool to create and compare the signatures. The big con is that you need to update the signature if the file changes, possible you need a way to get a dynamic signature after processing.
Also read this blog, which has a MD5 example: http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/
Your question is not really clear, so I have to make a few assumptions here:
- You are using selenium to automate your tests
- You know how to access directories on your own PC
My suggestion is:
- Use selenium to click this download button
- Get the file name that you want to download, say it is "
- Access the folder where you save your downloaded files
- Make sure there is no "
chrome.exe" previously saved, if there is one or more, you will need to delete them before you test starts OR use regular expression to locate the latest one
Without much details, this is about as much as I can help you with.