I want to create 10 emails on ProtonMail.
I already automated half of the part, using PyAutoGui
and Selenium
but I want to make it like a checker because sometimes usernames are taken.
Now what I wanna do is this:
- Generate Random Usernames
- Check the usernames
either by Selenium or another package(suggestions if you know any)
- If the username is valid, a notepad will be created to save the valid usernames.
This is the concept of what I am trying to build now. I am truly sorry if I sound garbage but I legit started using Python a few days ago and it hasn't yet been a week so... I'm learning :P
I have automated the part where Selenium fills the form of ProtonMail for Sign In / Sign Up, but sometimes I get the error that the Username is already taken and I want the script to check if that error message pops up, and if it does, a "reserved code" line will be executed to fix the issue. Then, the code can continue. But, I want the script not to interfere with the "reserved code" if the element doesn't pop up.
If anyone is here just to get the code ready, here you go:
import selenium
import pyautogui
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
#Variables
protonmail = "https://mail.protonmail.com/create/new?language=en"
username = input("Please enter your desired username for the email:")
password = input("Enter your password:")
driver = webdriver.Firefox()
time.sleep(4)
driver.get(protonmail)
time.sleep(7)
pyautogui.click(535, 501)
time.sleep(1)
pyautogui.typewrite(username)
time.sleep(2)
driver.find_element_by_xpath(
"/html[1]/body[1]/div[2]/div[1]/div[1]/div[1]/div[1]/form[1]/div[1]/div[2]/div[1]/div[1]/input[1]").send_keys(
password)
time.sleep(2)
driver.find_element_by_xpath(
"/html[1]/body[1]/div[2]/div[1]/div[1]/div[1]/div[1]/form[1]/div[1]/div[2]/div[2]/div[1]/input[1]").send_keys(
password)
time.sleep(2)
pyautogui.click(1284, 916)
time.sleep(2)
pyautogui.click(655, 762)
time.sleep(3)