哄女朋友必备之微信自动发红包脚本(python+adb+androidviewclient)

具体操作与上一篇朋友圈点赞类似,这里放个代码

注1:运行前打开这个界面

注2:发很多的话要几个延时函数,不然微信会报“系统繁忙”

哄女朋友必备之微信自动发红包脚本(python+adb+androidviewclient)_第1张图片

 

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

 

你可能感兴趣的:(微信)