Automation Google login with python and selenium shows “”This browser or app may be not secure””

First of all don’t use chrome and chromedriver. You need to use Firefox.(if not installed) Download and install Firefox. Login to Google with normal Firefox.

You need to show the Google site that you are not a robot. You can use code like this:

from selenium import webdriver
import geckodriver_autoinstaller
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

geckodriver_autoinstaller.install()

profile = webdriver.FirefoxProfile(
    '/Users/<user name>/Library/Application Support/Firefox/Profiles/xxxxx.default-release')

profile.set_preference("dom.webdriver.enabled", False)
profile.set_preference('useAutomationExtension', False)
profile.update_preferences()
desired = DesiredCapabilities.FIREFOX

driver = webdriver.Firefox(firefox_profile=profile,
                           desired_capabilities=desired)

This can help you find your profile location.

But, why Firefox?

Actually there is only one reason, chromedriver was coded by Google.
They can easily understand if it is a bot or not. But when we add user data with Firefox, they cannot understand if there is a bot or not.

You can fool Google like this. It worked for me too. I tried very hard to do this. Hope it will be resolved in you too.

Leave a Comment