daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Dec 29th, 2016 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. from selenium.webdriver.support.ui import WebDriverWait
  4. from selenium.webdriver.support import expected_conditions as EC
  5. import time
  6. import csv
  7.  
  8. nameFile = open('C:\\Users\\Owner\\Desktop\\Important Stuff\\Automated Emails\\names.csv')
  9. nameReader = csv.reader(nameFile)
  10. nameData = list(nameReader)
  11.  
  12. for i in range(0,len(nameData)):
  13.     USER = nameData[i][0]
  14.     PASS = nameData[i][1]
  15.     browser = webdriver.PhantomJS("C:\\Users\\Owner\\Desktop\\Important Stuff\\Automated Emails\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe")
  16.     browser.get(('https://accounts.google.com/ServiceLogin?'
  17.                  'service=mail&continue=https://mail.google'
  18.                  '.com/mail/#identifier'))
  19.  
  20. # fill in username and hit the next button
  21.  
  22.     username = browser.find_element_by_id('Email')
  23.     username.send_keys(USER)
  24.  
  25.     nextButton = browser.find_element_by_id('next')
  26.     nextButton.click()
  27.  
  28. # wait for transition then continue to fill items
  29.  
  30.     password = WebDriverWait(browser, 10).until(
  31.         EC.presence_of_element_located((By.ID, "Passwd")))
  32.  
  33.     time.sleep(.5)
  34.  
  35.     password.send_keys(PASS)
  36.  
  37.     signInButton = browser.find_element_by_id('signIn')
  38.     signInButton.click()
  39.  
  40.    # check for error message
  41.     try:
  42.         success_bool = browser.find_element_by_id("errormsg_0_Passwd")
  43.         print ("Invalid Password |", USER,":",PASS, sep = "")
  44.         time.sleep(2)
  45.         browser.quit()
  46.     except TimeoutException:
  47.         print ("Timeout |", USER,":",PASS, sep = "")
  48.     except:
  49.         print ("You're in | ", USER,":",PASS, sep = "")
  50.         browser.quit()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top