android UiAutomator写一个给微信朋友圈所有动态点赞的用例
来源:互联网 发布:广汽丰田一汽丰田 知乎 编辑:程序博客网 时间:2024/04/28 04:29
本人在是呀UiAutomator的过程中,突发奇想,写一个自动给朋友圈点赞的用例,经过尝试,终于成功,效果不错。这个方法用的是for循环,也可以用while循环,加一条判断如果本页全部点赞就跳出来这样的判断即可。分享代码,供大家参考。
public void test003LikeAllStatusInFriendCircle () throws InterruptedException, IOException, UiObjectNotFoundException {stopWechat();//关闭微信startWechat();//启动微信enterFriendCircle();//进入朋友圈for(int k = 0;k < 5;k++){//循环5次UiObject one = getUiScrollabe();//获取朋友圈动态的可滚动控件int num = one.getChildCount();//获取当前页面朋友圈动态条数for(int i =0;i < num-1;i++){//循环,此处-1因为点赞可能会导致最后一跳动态在前几条点赞后不在当前页面,后面scrollforward方法已经处理UiObject two = one.getChild(new UiSelector().className("android.widget.FrameLayout").index(i));//获取朋友圈动态控件UiObject three = two.getChild(new UiSelector().resourceId("com.tencent.mm:id/cw7"));//获取已经点赞的空间if (three.exists() && three.getText().trim().contains("尘")) {//如果存在且包含当前帐号就跳过continue;}if (!two.getChild(new UiSelector().description("评论")).exists()) {//如果评论按钮不存在,跳过continue;}two.getChild(new UiSelector().description("评论")).click();//点击评论按钮if (getUiObjectByText("取消").exists()) {//如果是取消按钮,则跳过,防止在滚动和循环的时候出错swipeLeft();//滑动是弹框消失continue;}waitForTextAndClick("赞");//点击赞}getUiScrollabe().scrollForward(50);//50步长向下滚动屏幕}stopWechat();//关闭微信}
阅读全文
0 0
- android UiAutomator写一个给微信朋友圈所有动态点赞的用例
- android UiAutomator写一个QQ小号给大号点赞的case
- 【学习写测试用例2】如何测试微信朋友圈对你的状态进行点赞
- Python & Adb Shell & UiAutomator -- 微信自动发朋友圈/点赞/...
- 类似微信朋友圈动态的数字红点
- android uiautomator写一个崩溃的监听
- php写的微信朋友圈
- android UiAutomator如何向所有微信好友发送一条“你好,***”开头的祝福消息
- 这篇文章来自我的微信朋友圈,并不特别好玩,但可以给创业者补点财务知识
- android uiautomator如何写一个定时任务的方法
- android UiAutomator写一个等待对象出现的方法
- android uiautomator如何写一个带参数的方法--以画圆为例
- android UiAutomator一个完整的班级功能测试用例
- android UiAutomator一个完整的个人信息修改测试用例
- android UiAutomator一个充值微信支付页面的用例
- android微信朋友圈分享
- android 微信朋友圈相册封面裁剪的小秘密
- Android问题—处理微信朋友圈的数据
- 关于在开发过程中 跳转页面被拦截问题
- Piggy-Bank(hdu-1114)(完全背包)
- win10 edge浏览器去掉自动识别电话号码功能
- C#人脸识别入门篇(Step by step 人脸识别)
- 运用触发器定位不知源的weblogic
- android UiAutomator写一个给微信朋友圈所有动态点赞的用例
- NIO与I/O的区别
- java动态代理原理及解析
- Log4net使用探究
- Xlistview的依赖
- LeetCode刷题之路(一)——easy的开始
- 世界数据中心新闻摘要
- 纯CSS3向右循环闪过效果
- windows下Git使用系列(2)- Git与TortoiseGit基本操作