Created
January 25, 2017 13:26
-
-
Save codetalks-new/58996cf1605795b608c4e61328abe72f to your computer and use it in GitHub Desktop.
微信 Android 自动发红包脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from com.android.monkeyrunner import MonkeyRunner as mr,MonkeyDevice as md | |
# Imports the monkeyrunner modules used by this program | |
# usage : $monkeyrunner main.py | |
# 下面的坐标是针对 1080 x 1920 的设备的 如果是其他分辨率的设备请自行调整 | |
__author__ = 'banxi' | |
# Connects to the current device, returning a MonkeyDevice object | |
print("Waiting for connect...") | |
device = mr.waitForConnection() | |
print("Connected") | |
def send_red_packet(): | |
# # 1) 按 + 号 :建议先手动按 + 号. 因为发完一个红后包, 停留在第二位. | |
# device.touch(1005,1857, md.DOWN_AND_UP) | |
# mr.sleep(0.2) | |
# # 2) 点击红包 | |
device.touch(200,1608, md.DOWN_AND_UP) | |
# 等待加载 ,最好先手动点击加载一次, 然后就不用等太久了. | |
mr.sleep(1) | |
# 3) 点击红包个数 输入框, | |
device.touch(856,335, md.DOWN_AND_UP) | |
# 4) 输入红包个数 | |
device.type('3') | |
mr.sleep(0.2) | |
# 5) 点击红包金额输入框 | |
device.touch(754,613, md.DOWN_AND_UP) | |
# 6) 输入总金额 | |
device.type('0.06') | |
mr.sleep(0.2) | |
# 7) 点击留言 | |
device.touch(754,868, md.DOWN_AND_UP) | |
# 8) 输入留言 | |
# 暂时无法输入留言. | |
mr.sleep(0.3) | |
# 9) 点击塞钱进线包 | |
device.touch(754,1372, md.DOWN_AND_UP) | |
# 10) 输入支付密码 | |
mr.sleep(2.5) # 等待弹出支付输入框 | |
# 输入密码 | |
device.touch(162,1290, md.DOWN_AND_UP) | |
device.touch(162,1290, md.DOWN_AND_UP) | |
device.touch(162,1290, md.DOWN_AND_UP) | |
device.touch(162,1290, md.DOWN_AND_UP) | |
device.touch(162,1290, md.DOWN_AND_UP) | |
device.touch(162,1290, md.DOWN_AND_UP) | |
# 要发送红包数 | |
max_red_packet_count = 20 | |
packet_count = 0 | |
while packet_count < max_red_packet_count: | |
send_red_packet() | |
print(u"第 %d 个发送完成 " % (packet_count + 1)) | |
mr.sleep(1.5) | |
packet_count += 1 | |
print("红包全部发送完") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment