Advertisement
Guest User

Untitled

a guest
Jan 26th, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. amountOfViews = raw_input("How many views do you want on your LeafiiViewBot?: \n")
  2. #
  3. # If you comment out the raw_input username and password, then you can set those variables to a fixed value, so you just need to enter the amount of views you want.
  4. #
  5. #username = raw_input("What is your username (It's an email): \n")
  6. username = "TheWolfBadger@gmail.com"
  7. #password = raw_input("What is your password: \n")
  8. password = "- redacted -"
  9. from selenium import webdriver
  10. from time import sleep
  11. viewCount = 0
  12. while viewCount < int(amountOfViews):
  13.     driver = webdriver.Chrome()
  14.     try:
  15.         driver.get("https://leafii.com/")
  16.         sleep(1)
  17.         sign_in = driver.find_element_by_xpath('//*[@id="toolbar"]/md-toolbar/div/div[2]/a[2]')
  18.         sign_in.click()
  19.         sleep(2)
  20.         usernameBox = driver.find_element_by_xpath('//*[@id="input_0"]')
  21.         passwordBox = driver.find_element_by_xpath('//*[@id="input_1"]')
  22.         signin_btn = driver.find_element_by_xpath('//*[@id="signin"]/div[2]/form/div[1]/button')
  23.         usernameBox.send_keys(username)
  24.         passwordBox.send_keys(password)
  25.         signin_btn.click()
  26.         sleep(11)
  27.         viewBtn = driver.find_element_by_xpath('//*[@id="profile"]/div[2]/div/md-card/a[2]/button')
  28.         viewBtn.click()
  29.         driver.quit()
  30.         viewCount += 1
  31.         print "SUCCESS: We have viewed the website!"
  32.         print "Views counted: " + str(viewCount) + "/" + str(amountOfViews)
  33.     except:
  34.         driver.quit()
  35.         print "ERROR: Error has occured! Rerunning script!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement