首先,我需要的工具和组件有:
-
Chrome浏览器
-
浏览器驱动ChromeDriver
-
Python 3.5
-
Web应用测试工具Splinter
代码部分:
from splinter import Browser
import time
def login():
b = Browser(driver_name="chrome")
b.visit("签到连接地址")
b.fill("qq","用户名")
b.fill("pass","密码")
button = b.find_by_value("登 录")
button.click()
button2 = b.find_by_value("立即签到")
button2.click()
def qiandao():
#判断是否到签到时间
mytime = time.strftime("%H:%M:%S")
mytime = mytime.split(":")
if int(mytime[0]) > 20 and int(mytime[0]) <21:
login()
elif int(mytime[0]) > 21:
print("超过了签到时间了")
else:
print("还没到签到时间哦")
if __name__ == "__main__":
qiandao()