Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import time
  2. import unittest
  3. from selenium import *
  4. from selenium.webdriver.chrome.service import Service
  5. from selenium.webdriver.common.keys import Keys
  6. import random
  7. import string
  8. from selenium.webdriver.support.ui import WebDriverWait
  9. from selenium.webdriver.support import expected_conditions as EC
  10. from selenium.webdriver.common.by import By
  11. from selenium.common.exceptions import TimeoutException
  12. from selenium.webdriver.chrome.options import Options
  13. from selenium import webdriver
  14.  
  15.  
  16. options = Options()
  17. options.headless = False
  18. delay = 10 # seconds
  19. rdname = ('').join(random.choices(string.ascii_letters + string.digits, k=8))
  20. join = int(input("How many bots would you like: "))
  21. x = input("What is the game Id?: ")
  22. driver = webdriver.Chrome("chromedriver.exe", options=options)
  23.  
  24.  
  25. def bot():
  26. driver.get('http://www.kahoot.it')
  27. elem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.ID, 'game-input')))
  28. time.sleep(.1)
  29. elem.clear() #Clears any entered text.
  30. elem.send_keys(x) #Types out game id
  31. elem.send_keys(Keys.RETURN) #Hits the Enter key
  32. myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.ID, 'nickname')))
  33. myElem.send_keys(rdname)
  34. myElem.send_keys(Keys.RETURN)
  35.  
  36. try:
  37. if join > 100:
  38. print("Error: This exceeds the max bot limit of 100.")
  39. else:
  40. while join > 0:
  41. print(join)
  42. bot()
  43. print("Bot Joined")
  44. join -= 1
  45. else:
  46. print("Bot Flooding is finished")
  47. except:
  48. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement