Advertisement
Geocrack

mathebattle.de

Sep 10th, 2022 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. from concurrent.futures import thread
  2. from selenium import webdriver
  3. from selenium.webdriver.common.by import By
  4. from threading import Thread
  5.  
  6.  
  7. def mathebattle():
  8.     driver = webdriver.Chrome(executable_path = r'selenium_webdriver\chromedriver.exe')
  9.     driver.get("https://mathebattle.de/users/login")
  10.     username = driver.find_element(By.ID, 'UserUsername')
  11.     username.send_keys("Username")
  12.     username = driver.find_element(By.ID, 'UserPassword')
  13.     username.send_keys("Password")
  14.     driver.find_element(By.XPATH,"//input[@type='submit' and @value='Einloggen']").click()
  15.  
  16.     driver.get("https://mathebattle.de/edu_randomtasks/training_show/210")
  17.     while True:
  18.         search_field = driver.find_element(By.XPATH, "//span[@class='bigger']").text
  19.         arimetic_operation = search_field.replace("=", "").replace(" ", "")
  20.         ergebnis = eval(arimetic_operation)
  21.         print(ergebnis)
  22.         search_field = driver.find_element(By.XPATH, "//*[@id='value']")
  23.         search_field.send_keys(ergebnis)
  24.         search_field.submit()
  25.         driver.find_element(By.LINK_TEXT, "Gleichen Aufgabentyp nochmal rechnen").click()
  26.  
  27.  
  28. thread_1 = Thread(target=mathebattle)
  29. thread_1.start()
  30. thread_2 = Thread(target=mathebattle)
  31. thread_2.start()
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement