I am trying to run a selenium code in Google Colab.
But I need a driver which is undetectable because I need to login to gmail.
What I have tried so far –
-
google_colab_selenum (undetected version) – https://github.com/jpjacobpadilla/Google-Colab-Selenium
-
Seleniumbase
I am getting the below same error for both the packages –
SessionNotCreatedException: Message: session not created: cannot connect to chrome at 127.0.0.1:9222
from chrome not reachable
Here are all the commands that I am trying before running code –
!pip install selenium
!apt-get update
!apt-get install -y chromium-browser
!apt install chromium-chromedriver
%pip install google-colab-selenium[undetected]
And ere is the simple code I am trying to initiate the driver –
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import google_colab_selenium as
from seleniumbase import Driver
driver = gs.UndetectedChrome()
driver = Driver(uc=True, headless=True)
What are the other alternatives?
stanabk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Found the answer. You should install regular Chrome and not chromium-browser.
Thanks Michael for answering – https://github.com/seleniumbase/SeleniumBase/discussions/2931
stanabk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.