from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time, re
from selenium.webdriver.common.proxy import *
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.proxy import Proxy, ProxyType
import threading
import time
import csv
import imaplib
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from threading import Thread,Barrier
#Countryinformation
country = input("Accountcountry:")
def func(threads):
driver = webdriver.Chrome(executable_path=r"C:/Users/Henning/Downloads/chromedriver-win32")
driver.get(url)
try:
click_button = driver.find_element(By.XPATH,
"/html/body/div[2]/div/div[2]/div/div/div/div/div/section/div[2]/div/button[1]")
click_button.click()
except:
print("failed collecting cookies(retrying)")
else:
print("collected Cookies1")
time.sleep(3)
try:
driver.execute_script("window.scrollTo(10, document.body.scrollHeight);")
time.sleep(2)
except:
print("failed creating Account")
driver.quit()
else:
print("scoll down do log in")
time.sleep(1)
try:
click_button = driver.find_element(By.XPATH,
"/html/body/div[4]/div/footer/div/div[1]/div[1]/div/div[1]/div/ul/li[4]/a")
click_button.click()
except:
print("failedcreatingaccount")
else:
print("reachedpage2")
time.sleep(10)
try:
click_button = driver.find_element(By.XPATH,
"/html/body/div[6]/div/div/div/div/div/section/div[2]/div/button[1]")
click_button.click()
except:
print("failed collecting cookies(retrying)")
else:
print("collected Cookies2")
time.sleep(1)
try:
click_button = driver.find_element(By.XPATH,
"/html/body/div[4]/div/div/div[2]/div[4]/div/div/div/div/div[2]/div/div/div/a")
click_button.click()
except:
print("failedcreatingaccount")
else:
print("reachedpage3(register)")
time.sleep(10)
# fillemail
try:
mail_element = driver.find_element(By.ID, "username")
print(mail_element)
time.sleep(1)
mail_element.send_keys(mail_adresse)
except:
print("failedtofillmail")
else:
print("filledmail")
time.sleep(5)
try:
click_button = driver.find_element(By.XPATH, "/html/body/div[1]/div/div/div/div/form/div/div[4]/button")
click_button.click()
except:
print("failedcreatingaccount")
else:
print("clickedbutton")
threads.wait()
url = ('httpsmeine url' + country + '/launch?s=upcoming')
Threads = 3
barrier = Barrier(Threads)
threads = []
for _ in range(Threads):
i = Thread(target=func, args=(barrier,))
i.start()
threads.append(i)