0

Can't find any solution for auto login google (gmail) account.

Here is my code :

import os

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

opt = Options()
executable_path = r'chromedriver'
os.environ["webdriver.chrome.driver"] = executable_path
opt.add_extension(r'C:\Users\SAMSUNG\Desktop\SB.crx')
opt.add_extension(r'C:\Users\SAMSUNG\Desktop\proxy.crx')
opt.add_argument('--disable-blink-features=AutomationControlled')
opt.add_experimental_option("excludeSwitches", ["enable-automation"])
opt.add_experimental_option('useAutomationExtension', False)
opt.add_argument("window-size=1280,800")

usernameStr = 'x'
passwordStr = 'y'

driver = webdriver.Chrome(r'C:\Users\SAMSUNG\Desktop\chromedriver', options=opt)
time.sleep(5)
driver.get(('https://accounts.google.com/ServiceLogin?'
             'service=mail&continue=https://mail.google'
             '.com/mail/#identifier'))

# fill in username and hit the next button

username = driver.find_element_by_id('identifierId')
username.send_keys(usernameStr)
time.sleep(2)
nextButton = driver.find_element_by_id('identifierNext')
nextButton.click()

# wait for transition then continue to fill items

password = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.NAME, "password")))

password.send_keys(passwordStr)

signInButton = driver.find_element_by_id('passwordNext')
signInButton.click()

But i keep getting this error : This browser or app may not be secure. Learn more Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in.

ERROR

Salma Madini
  • 15
  • 2
  • 9
  • Are you signing into main google? – The Pilot Dude Feb 10 '21 at 12:15
  • @ThePilotDude Yes – Salma Madini Feb 10 '21 at 12:36
  • what are you trying to access with your google account. Gmail? Calenders? Classroom? – The Pilot Dude Feb 10 '21 at 12:44
  • @ThePilotDude Gmail and Google Account Setting ( security tab ) – Salma Madini Feb 10 '21 at 12:52
  • It is always hard to trick google... But it is possible. Big companies have invested a lot in fraud detection, and even you hit it from proxy, VPN, selenium, protractor, UFT,... they have a way to take a fingerprint from your PC, and it is way more than your Ip address. Whish you luck.:-) – Gaj Julije Feb 10 '21 at 20:43
  • Does this answer your question? [“This browser or app may not be secure” error while attempting to login in to Gmail account using GeckoDriver Firefox through Selenium and Python](https://stackoverflow.com/questions/59515561/this-browser-or-app-may-not-be-secure-error-while-attempting-to-login-in-to-gm) – questioning Nov 29 '21 at 10:36

0 Answers0