Create email account using Selenium in python
Selenium is a free (open source) automated testing suite for web applications across different browsers and platforms. Here is an example of how to use selenium to create an email account using Selenium in python using Google Chrome browser in Windows platform.
Install Selenium
pip install selenium
Download Google Chrome webdriver
Go to this website (https://chromedriver.chromium.org/downloads) and download Google Chrome webdriver
Create email account using selenium
Create and run the following python script.
from selenium import webdriver
# use https://protonmail.com as an example to create email account
url ='https://protonmail.com'
# specify the location of the google Chrome webdriver
driver = webdriver.Chrome('D:/Steem/chromedriver')
EMAIL_NAME = 'michael_ward_20183432'
EMAIL_PASSWORD = 'Test123456Pass'
driver.get(url)
driver.find_element_by_link_text('SIGN UP').click()
driver.implicitly_wait(3)
driver.find_element_by_class_name('panel-heading').click()
driver.implicitly_wait(3)
driver.find_element_by_id('freePlan').click()
driver.implicitly_wait(3)
# switch to the iframe top to write text in textbox
iframe_registration_top = driver.find_element_by_xpath("//iframe[@class='top']")
driver.implicitly_wait(3)
driver.switch_to.frame(iframe_registration_top)
driver.find_element_by_id('username').send_keys(EMAIL_NAME)
driver.implicitly_wait(3)
# switch back to the defaut iframe
driver.switch_to.default_content()
driver.find_element_by_id('password').send_keys(EMAIL_PASSWORD)
driver.implicitly_wait(3)
driver.find_element_by_id('passwordc').send_keys(EMAIL_PASSWORD)
driver.implicitly_wait(3)
# switch to the iframe bottom to click registration buttom
iframe_registration_bottom = driver.find_element_by_xpath("//iframe[@class='bottom']")
driver.implicitly_wait(3)
driver.switch_to.frame(iframe_registration_bottom)
driver.implicitly_wait(3)
driver.find_element_by_name('submitBtn').click()
driver.implicitly_wait(3)
# switch back to the defaut iframe
driver.switch_to.default_content()
driver.find_element_by_id('confirmModalBtn').click()
Nice code! Thanks, I tried, it stop at verification stage. Is there anyway to automate the email verification process?
It's important to remember that emails contain private information, so always handle them securely and ensure they are properly verified.
Sure, creating an email account programmatically using Selenium in Python can be a practical solution for automating repetitive tasks. The script provided demonstrates how to interact with web elements like buttons and input fields to simulate user actions such as signing up on ProtonMail. Remember to adjust the script according to your specific requirements, such as using different email providers or modifying the signup process. For those interested in email verification tools, consider checking out https://mailtester.ninja/ , which provides reliable email verification services.