[PYTHON] I want to create an Ubuntu chrome User Profile with Colab only

Introduction

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.

The error that occurred

This time, I sometimes could not log in due to the following problems. thread-22873505-6216761167860044958.png I created a different account and was able to log in, but would you please let me know if there is any solution.

What you are doing

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.

Difference from the article in [2]

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.

For those who couldn't do it this way

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

I want to create an Ubuntu chrome User Profile with Colab only
I want to be an OREMO with setParam!
I want to convert an image to WebP with lollipop
I want to manually create a legend with matplotlib
I tried to create an article in Wiki.js with SQLAlchemy
How to create an email user
I want to do ○○ with Pandas
I want to debug with Python
I want to use an external library with IBM Cloud Functions
I want to analyze logs with Python
I want to play with aws with python
I want to make an automation program!
I want to easily create a Noise Model
I want to create an API that returns a model with a recursive relationship in the Django REST Framework
I want to display only different lines of a text file with diff
I want to use MATLAB feval with python
I want to analyze songs with Spotify API 2
I want to send Gmail with Python, but I can't because of an error
I want to mock datetime.datetime.now () even with pytest!
I want to display multiple images with matplotlib.
I want to knock 100 data sciences with Colaboratory
I tried to build an environment of Ubuntu 20.04 LTS + ROS2 with Raspberry Pi 4
I want to write an element to a file with numpy and check it.
I want to analyze songs with Spotify API 1
I want to use Temporary Directory with Python2
I tried to detect an object with M2Det!
I don't want to use -inf with np.log
#Unresolved I want to compile gobject-introspection with Python3
I want to create a plug-in type implementation
I want to use ip vrf with SONiC
I want to solve APG4b with Python (Chapter 2)
I want to start over with Django's Migrate
I tried to create an environment to check regularly using Selenium with AWS Fargate
I want to realize something like AutoHotkey with AutoKey on Ubuntu (Kali Linux)
I want to write to a file with Python
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
I want to get an error message in Japanese with django Password Change Form
I want to extract only pods with the specified label using Label Selector in Client-go
I want to detect unauthorized login to facebook with Jubatus (1)
I want to transition with a button in flask
I want to handle optimization with python and cplex
I want to climb a mountain with reinforcement learning
An easy way to create an import module with jupyter
I tried to implement an artificial perceptron with python
I want to inherit to the back with python dataclass
I want to work with a robot in python.
I want to split a character string with hiragana
I want to AWS Lambda with Python on Mac!
[TensorFlow] I want to process windows with Ragged Tensor
I want to use OpenJDK 11 on Ubuntu Linux 18.04 LTS / 18.10
[ML Ops] I want to do multi-project with Python
I tried to make an OCR application with PySimpleGUI
I want to run a quantum computer with Python
I tried to find an alternating series with tensorflow
I want to bind a local variable with lambda
I want to improve efficiency with Python even in an experimental system (2) RS232C and pySerial
I want to improve efficiency with Python even in an experimental system (1) Install Anaconda with Chocolatey
[Solution] When I try to connect to CloudSQL with GAE, I get an ImportError only when using dev_appserver.
I want to remove Python's Unresolved Import Warning with vsCode
I want to use R functions easily with ipython notebook
I want to specify another version of Python with pyvenv