forked from nanxung/jd_mi_six_scripy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jd.py
25 lines (24 loc) · 868 Bytes
/
jd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python3
#coding:utf-8
from selenium import webdriver
#下面填入京东的用户名以及密码
jd_up={"ue":"****","pd":"****"}
chrome=webdriver.Chrome()
chrome.get(url="https://passport.jd.com/new/login.aspx?")
chrome.find_element_by_xpath("//*[@id=\"content\"]/div/div[1]/div/div[2]/a").click()
User=chrome.find_element_by_id("loginname")
User.clear()
User.send_keys(jd_up["ue"])
Passwd=chrome.find_element_by_id("nloginpwd")
Passwd.clear()
Passwd.send_keys(jd_up["pd"])
chrome.find_element_by_id("loginsubmit").click()
while True:
try:
chrome.get(url="https://item.jd.com/4099139.html")
chrome.find_element_by_id("choose-btn-ko").click()
chrome.find_element_by_id("order-submit").click()
print("抢购成功并且已下单!!")
chrome.quit()
except Exception:
print("还未开始抢购!!")