Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from concurrent.futures import thread
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from threading import Thread
- def mathebattle():
- driver = webdriver.Chrome(executable_path = r'selenium_webdriver\chromedriver.exe')
- driver.get("https://mathebattle.de/users/login")
- username = driver.find_element(By.ID, 'UserUsername')
- username.send_keys("Username")
- username = driver.find_element(By.ID, 'UserPassword')
- username.send_keys("Password")
- driver.find_element(By.XPATH,"//input[@type='submit' and @value='Einloggen']").click()
- driver.get("https://mathebattle.de/edu_randomtasks/training_show/210")
- while True:
- search_field = driver.find_element(By.XPATH, "//span[@class='bigger']").text
- arimetic_operation = search_field.replace("=", "").replace(" ", "")
- ergebnis = eval(arimetic_operation)
- print(ergebnis)
- search_field = driver.find_element(By.XPATH, "//*[@id='value']")
- search_field.send_keys(ergebnis)
- search_field.submit()
- driver.find_element(By.LINK_TEXT, "Gleichen Aufgabentyp nochmal rechnen").click()
- thread_1 = Thread(target=mathebattle)
- thread_1.start()
- thread_2 = Thread(target=mathebattle)
- thread_2.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement