How to send text to the Password field within https://mail.protonmail.com registration page?

To send a character sequence to the Password field as the the desired element outside of the <iframe> so you have to:

  • switch_to_default_content().
  • Induce WebDriverWait for the desired element to be clickable.
  • You can use the following Locator Strategies:

    • Code Block:

      chrome_options = webdriver.ChromeOptions() 
      chrome_options.add_argument("start-maximized")
      #chrome_options.add_argument('disable-infobars')
      driver = webdriver.Chrome(options=chrome_options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
      driver.get("https://protonmail.com/")
      WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@class="btn btn-default btn-short" and @href="https://stackoverflow.com/questions/57142447/signup"]"))).click()
      WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class="row"]//p[text()='Basic account with limited features']"))).click()
      WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class="btn btn-primary btn-lg pull-right" and @id='freePlan']"))).click()
      WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, "//div[@class="usernameWrap"]//iframe[@title="Registration form"]")))
      WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@class="input" and @id='username']"))).send_keys("Hamza_Mirchi")
      driver.switch_to_default_content()
      WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='password']"))).send_keys("Hamza_Mirchi")
      
  • Browser Snapshot:

protonmail_password

Leave a Comment