1

today i wrote an auto longin and create account functions in python it worked for sometime until gmail told me that my browser is not secure (i use chrome) so i turned off my pc waited a day and it still tells me this problem. but when i open chrome manaully i can longin with no problem.

here is the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from secret import name,nickname,username,password,phone_number

class CreateAccount():
    def __init__(self):
        self.driver = webdriver.Chrome(r"C:\Users\CHACHA\Downloads\chromedriver")
        self.driver.get("https://accounts.google.com/signup/v2/webcreateaccount?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&dsh=S-1492427877%3A1592229039501560&gmb=exp&biz=false&flowName=GlifWebSignIn&flowEntry=SignUp")
        Nickname = self.driver.find_element_by_xpath('//*[@id="firstName"]')
        Nickname.send_keys(nickname)
        Name = self.driver.find_element_by_xpath('//*[@id="lastName"]')
        Name.send_keys(name)
        UserName = self.driver.find_element_by_xpath('//*[@id="username"]')
        UserName.send_keys(username)
        Password = self.driver.find_element_by_xpath('//*[@id="passwd"]/div[1]/div/div[1]/input')
        Password.send_keys(password)
        Confirm = self.driver.find_element_by_xpath('//*[@id="confirm-passwd"]/div[1]/div/div[1]/input')
        Confirm.send_keys(password)
        suivant = self.driver.find_element_by_xpath('//*[@id="accountDetailsNext"]/span/span')
        suivant.click()
        time.sleep(4)
        Phone = self.driver.find_element_by_xpath('//*[@id="phoneNumberId"]')
        Phone.send_keys(phone_number)
        next = self.driver.find_element_by_xpath('//*[@id="view_container"]/div/div/div[2]/div/div[2]/div/div[1]/div/div / span / span')
        next.click()


class LogIn():
    def __init__(self):
        self.driver = webdriver.Chrome(r"C:\Users\CHACHA\Downloads\chromedriver")
        self.driver.get("https://accounts.google.com/ServiceLogin/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=AddSession")
        bar = self.driver.find_element_by_xpath('//*[@id="identifierId"]')
        bar.send_keys(f"{username}@gmail.com")
        suivant = self.driver.find_element_by_xpath('//*[@id="identifierNext"]/span/span')
        suivant.click()
        time.sleep(4)
        mot_de_pass = self.driver.find_element_by_xpath('//*[@id="password"]/div[1]/div/div[1]/input')
        mot_de_pass.send_keys(password)
        next = self.driver.find_element_by_xpath('//*[@id="passwordNext"]/span/span')
        next.click()
        time.sleep(5)
        try:
            confirm = self.driver.find_element_by_xpath('//*[@id="yDmH0d"]/c-wiz[2]/c-wiz/div/div[1]/ div / div / div / div[2] / div[3] / div / div[2] / div / span / span')
            confirm.click()
        except Exception:
            pass
smallpp
  • 11
  • 1

0 Answers0