badchoose.blogg.se

Create email protonmail
Create email protonmail








create email protonmail

After that, induce WebDriverWait in a try / except block to check if the error message exists or not. This code will switch to the iframe which contains the error message for username already taken - this is necessary for driver to locate the element. # Handle scenario where error message does NOT exist - meaning, username is not taken

create email protonmail

# better to write a handler method, instead of stuffing code into the try block # Handle scenario where error message exists - username is takenĮrror_message = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//p"))) # attempt to find the error message, catch the exception if it does not exist # switch to first iframe on the page which will contain the error message # Check for error message - this is in an iframe # Click Create Account - I assume you have already done these two steps This might be a good starting point for you: from import TimeoutException Your code sample is a bit hard to read, because your clicks are all on absolute coordinates, rather than actual WebElements, so I'm not entirely sure what is being clicked throughout your example. Based on your problem description, it seems like you want to proceed differently in your code based on the presence of this error message. I've just checked the ProtonMail sign up page to locate the error message you are talking about. "/html/body/div/div/div/div/div/form/div/div/div/div/input").send_keys( Username = input("Please enter your desired username for the email:") If anyone is here just to get the code ready, here you go: import seleniumįrom import Keysįrom import Byįrom import WebDriverWaitįrom import expected_conditions as EC But, I want the script not to interfere with the "reserved code" if the element doesn't pop up. 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. 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. This is the concept of what I am trying to build now. If the username is valid, a notepad will be created to save the valid usernames.Check the usernames either by Selenium or another package(suggestions if you know any).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. I want to create 10 emails on ProtonMail.










Create email protonmail