Skip to content

Commit

Permalink
修复支付相关的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongrencong committed Jan 4, 2021
1 parent 899b228 commit 52774c4
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 43 deletions.
137 changes: 99 additions & 38 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
3、不需要打包的,直接在项目根目录下 执行 python3 main.py
4、程序运行后,会打开淘宝登陆页,需要自己手动点击切换到扫码登陆

## 淘宝有针对selenium的检测,如果遇到验证码说明被反爬了,此时应该放弃挣扎,凡是用到selenium的都会严重依赖网速、电脑配置。
## 淘宝有针对selenium的检测,如果遇到验证码说明被反爬了,遇到这种情况应该换一个方案,凡是用到selenium的都会严重依赖网速、电脑配置。
## 如果想直接绕过淘宝的检测,可以手动打开浏览器登陆淘宝,然后再用selenium接管浏览器。只提供思路,具体实现大佬们可以自己摸索。
Binary file added icon/order.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jerry'
import datetime
from tkinter import *
from seckill.seckill_taobao import ChromeDrive

Expand All @@ -26,12 +27,14 @@ def main():

lbl = Label(win, text = "开抢时间:", width = 8, height = 2)
lbl.grid(column = 0, row = 0)
txt = Entry(win, width = 18)
start_time = StringVar()
txt = Entry(win, textvariable = start_time, width = 18)
txt.grid(column = 1, row = 0)
start_time.set(str(datetime.datetime.now()))

lbl2 = Label(win, text = "支付密码:", width = 8, height = 2)
lbl2.grid(column = 0, row = 1)
txt2 = Entry(win, width = 18)
txt2 = Entry(win, width = 18, show = '*')
txt2.grid(column = 1, row = 1)

b1 = Button(win, text = '开始', command = lambda: run_killer(txt, txt2))
Expand Down Expand Up @@ -65,6 +68,10 @@ def main():
txt8 = Label(win, text = '6、本项目仅供交流学习使用,请勿用于其它任何商业用途')
txt8.config(font = 'Helvetica -10 bold', fg = 'red')
txt8.place(x = 10, y = 220)

txt9 = Label(win, text = '7、如果想手动付款,输入开抢时间后不用输入支付密码,直接点开始就可以了')
txt9.config(font = 'Helvetica -10 bold', fg = 'red')
txt9.place(x = 10, y = 240)
win.mainloop()


Expand Down
Binary file modified seckill/__pycache__/seckill_taobao.cpython-37.pyc
Binary file not shown.
7 changes: 5 additions & 2 deletions seckill/seckill_taobao.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,18 @@ def sec_kill(self):

sleep(0.1)
if submit_succ:
self.pay()
if self.password:
self.pay()


def pay(self):
try:
element = WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'sixDigitPassword')))
element.send_keys(self.password)
self.driver.find_element_by_id('J_authSubmit').click()
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.ID, 'J_authSubmit'))).click()
print("付款成功")
except:
print('付款失败')
finally:
sleep(60)
self.driver.quit()

0 comments on commit 52774c4

Please sign in to comment.