Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def CreateAccount(rooturl,username,password,email,headless=False)->str:
- Init("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",headless)
- ret = GetPage(rooturl)
- if ret != 200:
- DeInit()
- return("ERROR: "+str(ret))
- ret = ClickElement_ByXPATH('//*[@id="top"]/div[1]/nav/div/div[3]/div[1]/a[2]/span',5,2)
- if ret != "OK":
- DeInit()
- return(ret)
- ret = GetElementListWhenIDContains("_xfUid-")
- if ret != "OK":
- DeInit()
- return(ret)
- time.sleep(1)
- ret = SetInElementList('autocomplete','username',username)
- if ret != "OK":
- DeInit()
- return(ret)
- time.sleep(1)
- ret = SetInElementList('autocomplete','new-password',password)
- if ret != "OK":
- DeInit()
- return(ret)
- time.sleep(1)
- ret = SetInElementList('autocomplete','email',email)
- if ret != "OK":
- DeInit()
- return(ret)
- time.sleep(1)
- ret = ClickElement_ByCSSSelector("dd > .iconic > i",5,1)
- if ret != "OK":
- DeInit()
- return(ret)
- ret = ProcessreCaptchaV2(3)
- ret = WaitUntilElementInvisible_ByCSSSelector('#js-regTimer > span',10)
- if ret != "OK":
- DeInit()
- return("ERRPR: ELEMENT NOT FOUND")
- ret = ClickElement_ByCSSSelector("#js-signUpButton",5,1)
- if ret != "OK":
- DeInit()
- return("ERROR: SUBMIT BUTTON NOT FOUND")
- ret = FindInSource("thanks for registering. in order to complete your registration, you must follow the link in the email that has been sent to you")
- if ret == "OK":
- DeInit()
- return("SUCCESS: ACCOUNT CREATE NEED EMAIL ACTIVATION")
- ret = FindInSource("thanks for registering. your registration is now complete.")
- if ret == "OK":
- DeInit()
- return("SUCCESS: ACCOUNT CREATE AND ACTIVATED")
- SwitchToWindow(2)
- ret = FindInSource("the specified user name is already in use")
- if ret == "OK":
- SwitchToDefault()
- DeInit()
- return("FAILED: USERNAME IN USE")
- ret = FindInSource("the specified email address is already in use")
- if ret == "OK":
- SwitchToDefault()
- DeInit()
- return("FAILED: EMAIL IN USE")
- SwitchToDefault()
- DeInit()
- return("OK")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement