“This browser or app may not be secure” error while attempting to login in to Gmail account using GeckoDriver Firefox through Selenium and Python

Ardo Rianda picture Ardo Rianda · Dec 28, 2019 · Viewed 8.8k times · Source

I want to login to my gmail account using selenium. I use python2.7 . It doesn't have error, but the page said that I couldn't sign in to my account because some reason. you can see the screenshot below. screenshot

it is my code:

import time
import selenium
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

EXE_PATH = r'C:\Users\LENOVO\Downloads\geckodriver.exe'
driver = webdriver.Firefox(executable_path=EXE_PATH)

def login():
    mail = 'myMail'
    pw = 'myPassword'
    driver.get('https://gmail.com')
    email = driver.find_element_by_name('identifier')
    email.send_keys(mail)
    driver.find_element_by_id('identifierNext').click()
    time.sleep(10)
    password = driver.find_element_by_name('password')
    password.send_keys(pw)
    driver.find_element_by_id('passwordNext').click()

what have to I do? please help me, I just a noob and beginner. thanks master

Answer

Norayr Sargsyan picture Norayr Sargsyan · Jun 4, 2020
  1. Open browser which controlled by selenium
  2. Open StackOverflow site manually(or another site which have authorization with google)
  3. Perform authorization with google manually

Then when you run your code again with gmail authorization it should work fine.