As generic automation the process we usually preferred to capture screenshot of either failed automation
test case or screenshot of all test cases as it helps us in debugging and
identifying the exact cause of our test cases.
But there are certain situations
in our project when we are executing our automation test either using selenium
grid or on some remote server or executing as part of the nightly build. In that case
if any error or issue occurred during execution it is very difficult and
cumbersome to troubleshoot that.