哄女朋友必備之微信自動發紅包腳本(python+adb+androidviewclient)

具體操作與上一篇朋友圈點贊類似,這裏放個代碼

注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()

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章