Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################
- # ScrapeLinker Create Account Code
- # ©2024 Scrapelinker.com
- ##################################
- from selenium import webdriver
- from selenium.webdriver.chrome.options import Options
- from selenium.webdriver.common.by import By
- from selenium.common.exceptions import NoSuchElementException
- from selenium.common.exceptions import TimeoutException
- from selenium.webdriver.support.wait import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- import time
- driver = None
- def Init():
- global driver
- options = Options()
- #options.add_argument("--headless")
- options.add_argument("--window-size=1920,1200")
- #options.add_argument("user-agent=scrapelinker")
- driver = webdriver.Chrome(options=options)
- return
- def DeInit():
- global driver
- driver.quit()
- return
- def GetPage(url:str)->str:
- global driver
- driver.get(url)
- return(driver.page_source)
- def CreateAccount():
- global driver
- Init()
- code = GetPage('https://scrapelinker.de/phpbb/')
- wait = WebDriverWait(driver, timeout=5)
- err = False
- try:
- wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'Register'))).click()
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(1)
- try:
- wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="agreed"]'))).click()
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(1)
- try:
- wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="username"]'))).send_keys("vampire")
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(1)
- try:
- wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="new_password"]'))).send_keys(r"password123")
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(1)
- try:
- wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="password_confirm"]'))).send_keys(r"password123")
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(1)
- try:
- wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="email"]'))).send_keys(r"info@scrapelinker.de")
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(1)
- try:
- wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="submit"]'))).click()
- except NoSuchElementException:
- DeInit()
- return("ERROR")
- except TimeoutException:
- DeInit()
- return("TIMEOUT")
- time.sleep(3)
- html = driver.page_source
- if "your account has been created. however" in html.lower():
- DeInit()
- return("CREATED")
- else:
- DeInit()
- return("FAILED")
- ret = CreateAccount()
- print(ret) #Either "OK", "ERROR", "TIMEOUT", "CREATED" or "FAILED"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement