--
The main problem people were facing while working with google Colab is
If you are not interacting with notebook for more than 90 minutes, its runtime is automatically disconnected.
The only solution to this is you should interact with notebook in regular intervals but this is not always possible. In this kind of situation it will be easy to write some code in the browser console which makes the environment active throughout your process.
Open Browser Console
ctrl + shift + i or Press F12
The browser developer tools will get open after that use the following procedure to open the console.
Click on console or Press ESC
Paste the following code in the console and hit Enter.
function ClickConnect(){
console.log("Working");
document.querySelector("colab-toolbar-button#toolbar-add-code").click()
}setInterval(ClickConnect,120000)
It will insert the code cell in the regular intervals. You can change the interval time according to your wish. The below code will be useful for inserting text cell in regular intervals.
function ClickConnect(){
console.log("Working");
document.querySelector("colab-toolbar-button#toolbar-add-text").click()
}setInterval(ClickConnect,120000)
This technique will surely help you from colab runtime disconnection.