Keyword 'Capture Page Screenshot' could not be run on failure

Hi Team,

I keep getting the below error while executing test cases for long hours

Keyword ‘Capture Page Screenshot’ could not be run on failure: InvalidSessionIdException: Message: invalid session id
WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status from tab crashed

Any idea why does this error, there is no screenshot to check if it is an application issue or script issue

Screenshot is made with a call to a webdriver API - if the webdriver itself was stopped or crashed - the screenshot call will also fail. Similarry, as the error message points out “session deleted because of page crash from unknown error” … That probably means that the browser or a tab in the browser has crashed or closed itself without webdriver expecting that and there’s an error, screenshot api cannot be called for that particular page because its not there anymore…

I am seeing this issue continuously, I am executing my scripts overnight and after every 15 hours, the page is crashing.

Is there any way to avoid this?