Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use selenium to realize Taobao just-in-time killing and grabbing order by python

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces python how to use selenium to achieve Taobao on-time kill order related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that after reading this python how to use selenium to achieve Taobao just-in-time kill single article will have a harvest, let's take a look.

1. Installation of ChromeDriver

If you want to use Selenium to successfully call the Chrome browser to complete the corresponding operation, you need to use ChromeDriver to drive.

Before downloading, let's confirm the version of Chrome browser we use. We only need the same number of digits in the red box.

Choose according to your own operating system

It can be found in the Scripts folder under the Python installation path

2. Implementation code from selenium import webdriverimport timeimport datetime#: open the Chrome browser browser = webdriver.Chrome () def login (): # Open the home page of Taobao and log in to browser.get by scanning the code ("https://www.taobao.com") time.sleep (3) if browser.find_element_by_link_text"): browser.find_element_by_link_text ("Dear, please log in") Please log in to ") .click () print (f" Please log in as soon as possible ") time.sleep (10) def picking (method): # Open the shopping cart list page browser.get (" https://cart.taobao.com/cart.htm") time.sleep (3) # whether to select all shopping carts if method = = 0: while True: try: If browser.find_element_by_id ("J_SelectAll1"): browser.find_element_by_id ("J_SelectAll1"). Click () break except: print (f "Buy button not found") else: print (f "Please manually check the items to be purchased") Time.sleep (5) def buy (times): while True: now = datetime.datetime.now (). Strftime ('% Y-%m-%d% Hpurs% MRV% S.% f') print (now) # comparison time Click settlement if now > times: # Click the settlement button while True: try: if browser.find_element_by_id ("J_Go"): browser.find_element_by_id ("J_Go"). Click () Print (f "settlement successful Prepare to submit order ") break except: pass # Click submit order button while True: try: if browser.find_element_by_link_text ('submit order'): browser .find _ element_by_link_text ('submit order') .click () print (f "snapped up successfully Please pay as soon as possible ") except: print (f" try to submit the order again ") time.sleep (0.01) if _ _ name__ = ='_ main__': login () Picking (0); buy ("2021-05-12 21 python 57 python 08.211142"); # modify it to your own time, pay attention to the time format must be on "how to use selenium to achieve Taobao just-in-time kill order" this article is introduced here, thank you for reading! I believe that everyone has a certain understanding of "how python uses selenium to achieve Taobao on-time kill and grab order" knowledge. If you still want to learn more knowledge, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report