python自动下单源码_python+selenium实现淘宝双十一自动下单

python+selenium实现淘宝双十一自动下单

# !/usr/bin/env python

# 2020/05/20

# 淘宝秒杀脚本,扫码登录版

from selenium import webdriver

import datetime,time

driver = webdriver.Chrome(executable_path=r"C:\workspace\Python\chromedriver.exe")

def auto_buy(order_time):

print('.........................start.........................')

driver.get("https://login.taobao.com/member/login.jhtml")

driver.implicitly_wait(10)

driver.find_element_by_css_selector('#login > div.corner-icon-view.view-type-qrcode > i').click()

time.sleep(10)

driver.get("https://cart.taobao.com/cart.htm")

if not driver.find_element_by_css_selector('#J_SelectAll1').is_selected():

driver.find_element_by_css_selector('#J_SelectAll1').click()

while True:

now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')

if now > order_time:

driver.find_element_by_css_selector('#J_Go').click()

driver.find_element_by_css_selector('#submitOrderPC_1 > div.wrapper > a.go-btn').click()

time.sleep(30)

print('.........................抢单成功,尽快付款.........................')

driver.quit()

break

if __name__ == "__main__":

order_time = input("请输入抢购时间,格式如(2020-05-20 16:45:00.000000):")

auto_buy(order_time)

print('.........................end.........................')

原文链接:https://blog.csdn.net/weixin_41780080/article/details/106250419

你可能感兴趣的:(python自动下单源码)