pip install selenium
# _*_coding:utf-8_*_
from selenium import webdriver
import datetime
import time
driver = webdriver.Firefox()
def login(uname, pwd):
driver.get("http://www.jd.com")
driver.find_element_by_link_text("你好,请登录").click()
time.sleep(3)
driver.find_element_by_link_text("账户登录").click()
driver.find_element_by_name("loginname").send_keys(uname)
driver.find_element_by_name("nloginpwd").send_keys(pwd)
driver.find_element_by_id("loginsubmit").click()
time.sleep(3)
driver.get("https://cart.jd.com/cart.action")
time.sleep(3)
driver.find_element_by_link_text("去结算").click()
now = datetime.datetime.now()
print now.strftime('%Y-%m-%d %H:%M:%S')
print 'login success'
# buytime = '2016-12-27 22:31:00'
def buy_on_time(buytime):
while True:
now = datetime.datetime.now()
if now.strftime('%Y-%m-%d %H:%M:%S') == buytime:
driver.find_element_by_id('order-submit').click()
time.sleep(3)
print now.strftime('%Y-%m-%d %H:%M:%S')
print 'purchase success'
time.sleep(0.5)
# entrance
login('username', 'password')
buy_on_time('2017-01-01 14:00:00')
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有