I Am creating a bot to create email accounts in bulk using Python with selenium web driver on chrome browser with proton mail as the email service. I am having issues prefilling the form fields when the test gets to the form page to fill out your email address etc. and getting this error on the terminal.
raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:
I Have tried increasing the wait time with no luck. I am using send_keys to prefill the fields but no luck. The tests shown in the code below all work except for the last one where it hits the form page to prefill the email username.
from selenium import webdriver
import time
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
url = 'https://protonmail.com/'
driver = webdriver.Chrome(
'/Users/[MYNAME]/Downloads/chromedriver')
driver.get(url)
signUp = WebDriverWait(driver, 5).until(
EC.visibility_of_element_located((By.XPATH, '//* .
[@href="signup"]')))
signUp.click()
panel = WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.CLASS_NAME, 'panel-heading')))
panel.click()
plan = WebDriverWait(driver, 2).until(
EC.element_to_be_clickable((By.ID, 'freePlan')))
plan.click()
username = WebDriverWait(driver, 3).until(
EC.element_to_be_clickable((By.ID, 'username')))
username.click()
username.send_keys('usernameForUSer')
I expect the username field to prefill.
There is an iframe
which blocking to access the element.You need to switched to iframe
first. Try following code.
WebDriverWait(driver, 15).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, 'iframe.top')))
username = WebDriverWait(driver, 3).until(EC.element_to_be_clickable((By.ID, 'username')))
username.click()
username.send_keys('usernameForUSer')
Browser Snapshot:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.