How do you guys deal with colab's time limit? I think there are many pioneers who have automatically connected to colab and struggled to avoid the 90-minute and 12-hour rules. Perhaps the most realistic solution is the one in the article below. [Fully automatic connection] Solved 90 minutes / 12 hours problem with only Colaboratory file [Using Selenium] I think there are various methods, but I think the first bottleneck is logging in to Google. This article skips it by having selenium load the logged-in UserProfile. I also tried to refer to this article, but I got stuck in creating a User Profile for Ubuntu chrome. The above article seems to have been working on Mac OS, but it seems that it was not possible with the Mac User Profile, so I started Ubuntu on Docker and created a User Profile that logged in to Chrome in it (For details, see See article above). So this article is aimed at the following people. ・ There is only a Windows environment in the first place ・ I'm not sure about Docker
The colab notebook created this time will be here. If you execute the cell from the top, you can (should) go to Google login.
This time, I sometimes could not log in due to the following problems. I created a different account and was able to log in, but would you please let me know if there is any solution.
The following two articles were referred to this time. [1] [Fully automatic connection] Solved 90 minutes / 12 hours problem with only Colaboratory file [Using Selenium] [2] Poem on Selenium on Colaboratory and Time Limit Avoidance Techniques [1] is the article above, but [2] is struggling to break through Google's certification within colab. In selenium, it is an option at startup
"--user-data-dir=dir_path"
Will create a UserProfile in that directory. This time, I managed to log in to Google in Colab by the method of [2] and save the User Profile.
Looking at the source code of the person who wrote the article in [2], The order was "Email address input-> Password input-> Example of squishy character string input", but as of May 9, 2020, you were required to authenticate the squishy character string immediately after entering your e-mail address. Also, when I tried it myself this time, I was also asked for SMS authentication of the phone. Probably, the login process will continue to be different due to changes in the specifications of Google's authentication system.
The most utilized selenium function in creating this code is ・ Webdriver.save_screenshot () ・ Webdriver.page_source (Webdriver is an instance). The first is a function that saves a screenshot of the currently displayed page. It can also be used in Headless mode, which is useful for checking what is being displayed at that time. The second is to get the html source of the page. While checking the screenshot and seeing if it is the target page, I think that it will be somehow if you look for the input form and button by staring at html.
Let's have a good corab life! !!
Recommended Posts