In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to automatically grab JD.com 's mobile phone on Python". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
#-*-Encoding: UTF-8-*-
From splinter. Browserimportbrowser
Importtime
Deflogin (b):
B.click_link_by_text ('account login')
Sleep time (1)
Fill in ('login', 'XXX') # JD.COM user name
Sleep time (1)
B. Fill in ('nloginpwd', 'XXX') # login password
Sleep time (1)
B.find_by_id ('loginsubmit'). Click ()
Printb
Return to b
# order Page
Reverse loop (b): # loop click
Try:
Ifb.title==' order settlement Page-JD.COM Mall':
B.find_by_text ('save consignee information'). Click ()
B.find_by_text ('Save payment and delivery method'). Click ()
B.find_by_id ('order-submit'). Click ()
Return to b
After many capture operations, Else:# may be transferred to the home page of JD.COM, so you need to reopen the home page of the phone.
b. Visit ('https://item. JD.com/4461470. Html') # URL of Glory V9
B.find_by_id ('choose-btn-qiang'). Click ()
Sleep time (1)
Loop (b) # Recursive operation
Exceptionexception: # avoid interrupting exception handling of the program
B.reload () # refresh the current page, that is, order submission page
Sleep time (1)
Loop (b) # call itself again
B = browser ()
B. Visit ('https://item.jd.com/4461470.html')
Sleep time (10)
B.click_link_by_text ('hello, please log in')
Sleep time (5)
B = login (b) # login
Sleep time (1)
WhileTrue:
Cycle (b)
IFB. Is _ element _ present _ by _ id ('try BTN'): # shows "snap up again" after the order is submitted.
B.find _ by _ id ('try BTN'). Click () # Click to snap up again, enter the countdown 5 and jump to the order page
time。 Sleep (6.5)
Elifb.title==' order settlement page-JD.COM Mall': # if it is still on the order settlement page
B.find_by_id ('order-submit'). Click ()
Else:
Print ("Congratulations, successful capture")
What are the advantages of Python: 1. Easy to use. Compared with traditional languages such as Java, Java and C #, Python has less strict requirements on code format. 2. Python is open source and everyone can see the source code and can be ported to many platforms. 3. Python is object-oriented and can support both process-oriented programming and object-oriented programming. 4. Python is an explanatory language, the program written by Python does not need to be compiled into binary code, and can be run directly from the source code; 5. Python is powerful and has many modules, which can basically achieve all the common functions.
This is the end of the content of "how to automatically grab JD.com 's mobile phone on Python". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.