0

my code is :

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
import time
import requests
from bs4 import BeautifulSoup

url = "https://google.com"
time.sleep(15)  
browser = webdriver.Chrome()
browser.get(url)
elem = browser.find_element_by_id('gb_70').click()
elem = browser.find_element_by_id('identifierId')
elem.send_keys("example")
elem = browser.find_elements_by_class_name('ZFr60d').click()
elem = browser.find_element_by_name('password')
elem.send_keys("example")

i'm going to try to login in to my Gmail account with Selenium Webdriver. when the driver starts, and my username filled into gmail input box, in the next step i get the following error from google:

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.

What should i do to solve this problem? it's very important to me.

P.S: i already tested the method with UA, but nothing happens

  • You need to use another ```User Agent```, you should try the library ```fake_useragent``` you can install it via pip. You can find more information [here](https://pypi.org/project/fake-useragent/) – EnriqueBet Apr 03 '20 at 18:16
  • @EnriqueBet , I already test this method and nothing will happens. – Jeremy Hunt Apr 03 '20 at 18:17
  • There are other ways to log in into your gmail account, you could use ```smptlib``` in order to achieve this, but it will requiere some configuration in your account. Take a look to this [post](https://stackabuse.com/how-to-send-emails-with-gmail-using-python/) – EnriqueBet Apr 03 '20 at 18:30
  • @EnriqueBet Gmail is only one side of my goal, Google Account and Google Services is the other side – Jeremy Hunt Apr 03 '20 at 18:32
  • Ok then, hopefully someone here knows how to do this, I am curious. – EnriqueBet Apr 03 '20 at 18:48
  • Generally speaking, attempting to automate Google websites if you don’t actually work for a team at Google developing that site is a Bad Idea™. Locators tens to change without notice, and it additionally tends to be a violation of Google’s Terms if Service. Fortunately, Google is pretty good about providing APIs for most of their products. Using those APIs would be a far better choice. – JimEvans Apr 07 '20 at 01:55
  • 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:39

0 Answers0