~ 1 min read

Google ColaB Tips and Tricks

Stop Google Colab from disconnecting

function ClickConnect() {
  console.log('Click Connect - Working')
  document
    .querySelector('#top-toolbar > colab-connect-button')
    .shadowRoot.querySelector('#connect')
    .click()
}
intervalClick1 = setInterval(ClickConnect, 180000)

OR

function ClickAddText(){
  console.log('Click Add Text - Working');
  document.querySelector('colab-toolbar-button#toolbar-add-text').click();
}
intervalClick2 = setInterval(ClickAddText, 240000);

Removal

clearInterval(intervalClick1);
clearInterval(intervalClick2);