- #!/usr/bin/env python
- #-*- coding: utf-8 -*-
- #by prehisle
- from splinter import Browser
- import datetime
- import time
- def U(x):
- return unicode(x, 'utf-8')
- PRICE = ""
- b = Browser('chrome')
- def endStep():
- nprice = PRICE
- while nprice == PRICE:
- b.reload()
- nprice = b.find_by_id('needPayPrice').value
- print U("%s-->当前价格%s") % (datetime.datetime.now().strftime("%H:%M:%S.%f"), nprice)
- print "提交定单.."
- b.find_by_id('submit').click()
- if __name__ == '__main__':
- print "开始.."
- b.visit('http://passport.jd.com/new/login.aspx?ReturnUrl=http://cart.jd.com/order/orderInfoMain.html')
- print "请先手动在浏览器导航到提交定单的最后一步,输入当前价格,然后按任意键继续!"
- PRICE = raw_input('')
- endStep()
- print "完成.."
- #该片段来自于http://www.codesnippet.cn/detail/300820135473.html
来源: http://www.codesnippet.cn/detail/300820135473.html