Created
July 10, 2020 11:36
-
-
Save e96031413/80a633f6a07c150b431639a4e3c606a8 to your computer and use it in GitHub Desktop.
防止Google Colab自动断开代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 每60分钟自动运行代码刷新,解除90分钟断开限制. | |
// 使用方法:colab页面按下 F12或者 Ctrl+Shift+I (mac按 Option+Command+I) 在console(控制台) 输入以下代码并回车. | |
// 复制以下代码粘贴在浏览器console!!不要关闭浏览器以免失效 | |
function ConnectButton(){ | |
console.log("Connect pushed"); | |
document.querySelector("#connect").click() | |
} | |
setInterval(ConnectButton,60000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function ConnectButton(){
console.log("Connect pushed");
document.querySelector("colab-connect-button").shadowRoot.querySelector("#connect").click();
}
setInterval(ConnectButton,60000);