1

I am writing a python program to delete a number of email from same user and for it i am using selenium as an automation program and to host that program in heroku The problem is when i login in gmail in my pc it is working just fine where as when i try it from selenium it gives me an error saying that it can't find email input field

note : to make selenium work on heroku i have use this method

here is my code

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome('chromedriver.exe')
driver.maximize_window()
driver.get('https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin')
driver.find_element_by_id('identifierId').send_keys('gpt.sahaj28@gmail.com') # here is when the error occur in heroku
driver.find_element_by_class_name('CwaK9').click()

at second last line error occur in heroku where as it works just fine in pc

i cant seem to figure out problem

Drac
  • 19
  • 3
  • Gmail is bloking access for automated scripts, see: https://support.google.com/accounts/answer/7675428?hl=en – Jonah Jun 18 '20 at 06:08

1 Answers1

0

So I highly don't suggest using selenium to delete a user's email, as it may be violated Gmail's Terms of Use and Privacy Policy. What I suggest more is using Gmail's API to manage user's emails. Hope that helps.

boyuan12
  • 13
  • 2