ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

微信运动圈自动点赞(自动跳过自己)

2021-07-22 11:33:25  阅读:21  来源: 互联网

标签:RLayout1 微信 点赞 ele 自动 RLayout position rid android


import uiautomator2 as u2

d = u2.connect('172.20.25.212:5555')
d.implicitly_wait(5)
rid = '//*[@resource-id="com.tencent.mm:id/c68"]'
LLayout = '/android.widget.LinearLayout'
RLayout = '/android.widget.RelativeLayout'
TView = '/android.widget.TextView'
VGroup = 'android.view.ViewGroup'
IView = '/android.widget.ImageView'
View = '/android.view.View'

rid_RLayout = rid + RLayout
LLayout1_RLayout2 = LLayout + "[1]" + RLayout + "[2]"
RLayout1_RLayout1 = LLayout + "[1]" + RLayout + "[1]" + View

i = 1
position = []
me_Name = d.xpath(
rid + RLayout + '[2]' + LLayout1_RLayout2 + RLayout1_RLayout1).get_text()
while True:
try:
ele_path = d.xpath(
rid_RLayout + "[" + str(i) + "]" + LLayout1_RLayout2 + RLayout + "[2]" + RLayout + "[1]" + IView + "[1]")
ele_name = d.xpath(rid_RLayout + "[" + str(i) + "]" + LLayout1_RLayout2 + RLayout1_RLayout1).get_text()
if ele_name == me_Name:
continue
x, y = ele_path.center()
if i == 1:
position.append([x, y])
position.append([x, y])
else:
position[1] = [x, y]
if ele_path.exists:
ele_path.click()
print(ele_name + '微信运动已点赞')
except Exception as e:
d.drag(position[1][0], position[1][1], position[0][0], position[0][1])
i = 0
finally:
i += 1

标签:RLayout1,微信,点赞,ele,自动,RLayout,position,rid,android
来源: https://www.cnblogs.com/futrueface/p/15043255.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有