具體操作與上一篇朋友圈點贊類似,這裡放個代碼
注1:運作前打開這個界面
注2:發很多的話要幾個延時函數,不然微信會報“系統繁忙”

# coding: utf-8
import sys
import os
import time
from com.dtmilano.android.viewclient import ViewClient
def fahongbao():
# 連接配接手機
device, serialno = ViewClient.connectToDeviceOrExit()
vc = ViewClient(device, serialno)
#發紅包
for i in range(20,2000):
try:
vc.dump()
touch_hongbao_button = vc.findViewWithTextOrRaise(u'紅包').touch()
vc.dump()
touch_hongbao_button = vc.findViewWithTextOrRaise(u'紅包').touch()
vc.dump()
touch_haobao2_button = vc.findViewByIdOrRaise("com.tencent.mm:id/dd").touch()
#下面的66為發紅包的金額
os.system("adb shell input text 66")
vc.dump()
touch_saihonhbao_button = vc.findViewByIdOrRaise("com.tencent.mm:id/da3").touch()
vc.dump()
touch_shiyongmima_button = vc.findViewWithTextOrRaise(u'使用密碼').touch()
#下面的123456改為支付密碼
os.system("adb shell input text 123456")
print "支付成功"
except:
print "支付失敗,可能是沒錢了!!!"
if __name__ == '__main__':
fahongbao()