Advertisement
ssdnet

Untitled

Feb 7th, 2024
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.61 KB | None | 0 0
  1. ##################################
  2. # ScrapeLinker Create Account Code
  3. # ©2024 Scrapelinker.com
  4. ##################################
  5.  
  6. from selenium import webdriver
  7. from selenium.webdriver.chrome.options import Options
  8. from selenium.webdriver.common.by import By
  9. from selenium.common.exceptions import NoSuchElementException
  10. from selenium.common.exceptions import TimeoutException
  11. from selenium.webdriver.support.wait import WebDriverWait
  12. from selenium.webdriver.support import expected_conditions as EC
  13. import time
  14.  
  15. driver = None
  16.  
  17. def Init():
  18.     global driver
  19.     options = Options()
  20.     #options.add_argument("--headless")
  21.     options.add_argument("--window-size=1920,1200")
  22.     #options.add_argument("user-agent=scrapelinker")
  23.     driver = webdriver.Chrome(options=options)
  24.     return
  25.  
  26. def DeInit():
  27.     global driver
  28.     driver.quit()
  29.     return
  30.  
  31. def GetPage(url:str)->str:
  32.     global driver
  33.     driver.get(url)
  34.     return(driver.page_source)
  35.  
  36. def CreateAccount():
  37.     global driver
  38.     Init()
  39.     code = GetPage('https://scrapelinker.de/phpbb/')
  40.  
  41.     wait = WebDriverWait(driver, timeout=5)
  42.  
  43.     err = False
  44.     try:
  45.         wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'Register'))).click()
  46.     except NoSuchElementException:
  47.         DeInit()
  48.         return("ERROR")                
  49.     except TimeoutException:
  50.         DeInit()
  51.         return("TIMEOUT")                
  52.    
  53.     time.sleep(1)
  54.    
  55.     try:
  56.         wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="agreed"]'))).click()
  57.     except NoSuchElementException:
  58.         DeInit()
  59.         return("ERROR")                
  60.     except TimeoutException:
  61.         DeInit()
  62.         return("TIMEOUT")                
  63.  
  64.     time.sleep(1)
  65.  
  66.     try:
  67.         wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="username"]'))).send_keys("vampire")
  68.     except NoSuchElementException:
  69.         DeInit()
  70.         return("ERROR")                
  71.     except TimeoutException:
  72.         DeInit()
  73.         return("TIMEOUT")                
  74.  
  75.     time.sleep(1)
  76.  
  77.     try:
  78.         wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="new_password"]'))).send_keys(r"password123")
  79.     except NoSuchElementException:
  80.         DeInit()
  81.         return("ERROR")                
  82.     except TimeoutException:
  83.         DeInit()
  84.         return("TIMEOUT")                
  85.  
  86.     time.sleep(1)
  87.  
  88.     try:
  89.         wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="password_confirm"]'))).send_keys(r"password123")
  90.     except NoSuchElementException:
  91.         DeInit()
  92.         return("ERROR")                
  93.     except TimeoutException:
  94.         DeInit()
  95.         return("TIMEOUT")                
  96.  
  97.     time.sleep(1)
  98.  
  99.     try:
  100.         wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="email"]'))).send_keys(r"info@scrapelinker.de")
  101.     except NoSuchElementException:
  102.         DeInit()
  103.         return("ERROR")                
  104.     except TimeoutException:
  105.         DeInit()
  106.         return("TIMEOUT")                
  107.  
  108.     time.sleep(1)
  109.  
  110.     try:
  111.         wait.until(EC.element_to_be_clickable((By.XPATH,'//*[@id="submit"]'))).click()
  112.     except NoSuchElementException:
  113.         DeInit()
  114.         return("ERROR")                
  115.     except TimeoutException:
  116.         DeInit()
  117.         return("TIMEOUT")                
  118.  
  119.     time.sleep(3)
  120.  
  121.     html = driver.page_source
  122.  
  123.     if "your account has been created. however" in html.lower():
  124.         DeInit()
  125.         return("CREATED")
  126.     else:
  127.         DeInit()
  128.         return("FAILED")
  129.    
  130.  
  131. ret = CreateAccount()
  132. print(ret)  #Either "OK", "ERROR", "TIMEOUT", "CREATED" or "FAILED"
  133.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement