After my girlfriend said good night to you, she was still online. I made a script in Python and successfully conquered it

Five packs of spicy strips! 2021-09-15 12:36:34
girlfriend said good night online.

Hello everyone , I'm spicy .


A friend of spicy bar recently complained to me : Girlfriend is addicted to Taobao rush shopping and can't extricate herself , When I don't sleep at night, I rush to buy it regularly , What a loser .

They are all good friends. Spicy strips must help , It's just a regular rush to buy , Empty the shopping cart regularly , This is called arrangement .

Climb to the target

Website : TaoBao


Tool use

development tool :pycharm development environment :python3.7, Windows10 Using the toolkit :selenuim

Demand analysis

Our goal is to kill Taobao's orders , There are several key points , First you need to log in to Taobao , Secondly, you need to prepare the order , Finally, the order should be submitted quickly at the appointed time .

Analysis of project ideas

selenium Installation configuration

selenium yes Python Tool library for automated testing , Some environment drivers need to be configured selenium install

pip install selenium

Selenium Once installed , It can't be used directly , It needs to dock with the browser . Here Chrome Browser as an example . If you want to use Selenium A successful call Chrome Browser to complete the corresponding operation , Need to pass through ChromeDriver To drive . link : According to their own chorme Version select the installed driver version



Once the download is complete , decompression , Place it in Python Under installation path python In the folder


Project analysis

Try to pass through selenium Open Taobao Homepage , Verify successful installation

from selenium import webdriver
driver = webdriver.Chrome()
 adopt xpath Locate and select the login tab , Buying scripts need to know what you're buying first  


The way to log in is optional ( You can log in with your account password , You can also scan the code to log in , Spicy bar logs in here by scanning the code )

Click the shopping cart after successful login , Select the product data you need ( You can select all , You can manually check )


Click the settlement button


Set a settlement time , The time you need to place an order


Wait for time to come Click the submit order button


Easy source sharing

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : BaiChuan
# @File   : Taobao rush .py
from selenium import webdriver
import datetime
import time
driver = webdriver.Chrome()
def login():
   # Open the Taobao login page , And scan the code to log in
   if driver.find_element_by_link_text(" Pro - , Please log in "):
       driver.find_element_by_link_text(" Pro - , Please log in ").click()
   print(" Please be there. 30 Scan code in seconds ")
   # Click the select all button in the shopping cart
   if driver.find_element_by_id("J_SelectAll1"):
   now =
   print('login success:', now.strftime('%Y-%m-%d %H:%M:%S:%f'))
def buy(buytime):
   while True:
       now ='%Y-%m-%d %H:%M:%S.%f')
       print(" current time " + now)
       # Compare time , When the time comes, click settlement
       if now > buytime:
               # Click the settlement button
               if driver.find_element_by_id("J_Go"):
               driver.find_element_by_link_text(' place order ').click()
if __name__ == "__main__":
   # times = input(" Please enter the rush time :")
   # Time format :"2018-09-06 11:20:00.000000"
   buy("2021-08-24 14:30:00.000000")

The script is finished, but it doesn't seem to be finished ......

本文为[Five packs of spicy strips!]所创,转载请带上原文链接,感谢

  1. Realizing the function of sending e-mail automatically with Python
  2. Smtpauthenticationerror in Python: solution
  3. 8 steps to teach you how to solve Sudoku in Python! (including source code)
  4. Python change la vie | identifier facilement des centaines de numéros de livraison
  5. Python change life | utilisation de modèles reconnus par ocr
  6. Bibliothèques Python utiles et intéressantes - - psutil
  7. 3. Traitement des données pandas
  8. 【Python编程基础】控制流之链式比较运算符
  9. MFC uses Python scripting language
  10. 【Python編程基礎】控制流之鏈式比較運算符
  11. 【 base de programmation python】 opérateur de comparaison de chaîne pour le flux de contrôle
  12. Python game development, pyGame module, python implementation of Xiaole games
  13. Mise en œuvre du Code de vérification unique (OTP) avec le cadre de repos Django
  14. Python - eval ()
  15. Python - Programmation orientée objet - _Rapport()
  16. Différence entre python - rep (), Str ()
  17. Python - Programmation orientée objet - _Appel()
  18. Python calling matlab script
  19. Python - Programmation orientée objet - _Nouveau() et mode Singleton
  20. Python - Programmation orientée objet - méthode magique (méthode de double soulignement)
  21. Python - Programmation orientée objet - pratique (6)
  22. Python - Programmation orientée objet - réflexion hasattr, GetAttr, GetAttr, delattr
  23. Python - Programmation orientée objet - _Dict
  24. Python - pydantic (2) Modèle imbriqué
  25. Non-ASCII character ‘\xe5‘ in file on line 4, but no encoding declared; see http://python.or
  26. python笔记(一)
  27. Non - ASCII character 'xe5' in file on Line 4, but no Encoding declared;Voirhttp://python.or
  28. Notes Python (1)
  29. Talk about how JMeter executes Python scripts concurrently
  30. In Beijing, you can't see the moon in the Mid Autumn Festival. Draw a blood red moon in Python
  31. Un des pandas crée un objet
  32. Machine learning | unitary regression model Python practical case
  33. Draw a "Lollipop chart" with Excel and python
  34. Python uses scikit learn to calculate TF-IDF
  35. Getting started with Python Basics_ 3 conditional statements and iterative loops
  36. Python dynamic properties and features
  37. 云计算开发:Python内置函数-min()函数详解
  38. [Python skill] how to speed up loop operation and numpy array operation
  39. 雲計算開發:Python內置函數-min()函數詳解
  40. Développement de l'informatique en nuage: explication détaillée de la fonction intégrée python - min ()
  41. 从0起步学Python(附程序实例讲解)第1讲
  42. 从0起步学Python(附程序实例讲解)第1讲
  43. Apprendre Python à partir de 0 (avec des exemples de programme) leçon 1
  44. Apprendre Python à partir de 0 (avec des exemples de programme) leçon 1
  45. With Python, I'll take you to enjoy it for a month when the Mid Autumn Festival is coming
  46. You can't write interface software in Python! Which software on sale has no UI?
  47. Python国内外原题解析及源码1~15
  48. Python实现长篇英文自动纠错~
  49. Python implémente la correction automatique des erreurs en anglais long
  50. Analyse des problèmes originaux et code source de Python au pays et à l'étranger 1 ~ 15
  51. 一张思维导图学Python之表白
  52. Python教学中课程思政建设的研究探索2
  53. Recherche sur la construction idéologique et politique du Programme d'études dans l'enseignement Python 2
  54. Une présentation de la cartographie mentale Python
  55. Python高级用法总结(8)-函数式编程
  56. Python + Mirai development QQ robot starting tutorial (2021.9.9 test is valid)
  57. Python Advanced use Summary (8) - functional Programming
  58. How to get started with Python and share learning methods for free. All you want to know is here
  59. Python + Mirai development QQ robot starting tutorial (2021.9.9 test is valid)
  60. Python基础第1讲(含代码、Python最新安装包、父与子的编程之旅:与小卡特一起学Python中文版)