为了省心,自己做了个京东签到的定时器#coding:utf8
from selenium import webdriver
import time
def sign_up():
url = r'https://passport.jd.com/new/login.aspx?ReturnUrl=http%3A%2F%2Fvip.jd.com%2F'
dr = webdriver.Firefox()
#dr = webdriver.PhantomJS()
dr.get(url)
try:
try:
login = dr.find_element_by_class_name('login-tab-r')
login.click()
loginname = dr.find_element_by_id('loginname')
loginname.send_keys('xxxxxxxx')#用户名
password = dr.find_element_by_id('nloginpwd')
password.send_keys('xxxxxxxxx')#密码
loginsubmit = dr.find_element_by_id('loginsubmit')
loginsubmit.click()
dou = dr.find_element_by_id('checkinBtn')
dou.click()
except:
print "first error"
try:
time.sleep(3)
url_jr = r'https://vip.jr.jd.com'
dr.get(url_jr)
jr_dou = dr.find_element_by_id('index-qian-btn')
jr_dou.click()
except:
print "second error"
except:
print "error"
finally:
dr.close()
sign_up()