[uiautomator篇]recent
def Recent(self):
d = Device('9410519008004c22098b')
displayWidth = int(d.info.get("displayWidth"))
displayHeight = int(d.info.get("displayHeight"))
d.press.recent()
if d(text="No recent items").wait.exists(timeout=2000):
print "Cleared recent items"
return True
if d(descriptionContains="Dismiss").wait.exists(timeout=2000):
for i in range(50):
if d(text="CLEAR ALL").wait.exists(timeout=2000):
d(text="CLEAR ALL").click()
if d(description="Apps list",index=3).wait.exists(timeout=2000):
print "Cleared recent items"
return True
else:
print "Fail to clear recent items"
return False
else:
d.swipe(displayWidth/2,displayHeight/4,displayWidth/2,3*displayHeight/4,steps=30)
i+=1
else:
print "Fail to find CLEAR ALL "
return False
else:
print "EXCEPTION CLEAR RECENT ITEMS"
return True
java version
package com.yang.clicktest; import com.android.uiautomator.core.UiDevice;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
import android.os.RemoteException; public class UiClickTest4 extends UiAutomatorTestCase { public void test() throws RemoteException, UiObjectNotFoundException, InterruptedException{ UiDevice.getInstance().pressRecentApps();
UiObject recentapp = new UiObject(new UiSelector().resourceId("com.android.systemui:id/dismiss_task")); do{
recentapp.waitForExists(2000);
if(recentapp.exists()){
recentapp.swipeLeft(5);
}
}while(recentapp.exists());
}
}
[uiautomator篇]recent的更多相关文章
- [uiautomator篇][1] 官网译文
http://www.jianshu.com/p/7718860ec657 2016.07.25 20:59 字数 3675 Android UIAutomator浅谈 --------------- ...
- [uiautomator篇] python uiautomatorDemo
#coding=utf-8 """ @version: 1.0 @author: @prerequisite: based on Python 2.7 @usage: 1 ...
- [uiautomator篇][exist 存在,但click错误]
uiautomator定位页面元素是,定位存在的;但是click的时候,发现点的位置不对,(不知道是android系统的问题还是uiautomator的问题,初步怀疑是系统的问题)
- [uiautomator篇] 使用uiautomator需要导入uiautomator库
1 修改依赖文件:build/gradle( 是在app目录下)而不是和app同级目录的build/gradle androidTestCompile 'com.android.support.tes ...
- [Uiautomator篇][2] UiDeviceAPI介绍
1 https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html http://www.cnb ...
- [UiAutomator篇][3] 打开音乐应用的测试脚本
package qq.test; import android.content.Context; import android.content.Intent; import android.suppo ...
- [uiautomator篇] 找父亲节点和其他兄弟节点
https://testerhome.com/topics/1250 Appium [已解决] UiSelector 如何根据节点定位到父节点 / 兄弟节点? liqing380 · 发布于 2014 ...
- [uiautomator篇] uiautoviewer 定位不到元素
定位工具: Uiautomatorviewer 在我们的APP中,只有这一个页面,元素无法加载出来,其它的都没有什么问题. 提示的错误:Error while obtaining UI hiera ...
- [uiautomator篇] 获取当前页面的方法
Uiautomator 在2.0之前的版本里就提供了getCurrentActivity()的方法,但返回内容不正确:2.0 版本今天尝试了下,还是返回有问题的: 有点没描述清楚啊,是在uiautom ...
随机推荐
- VirtualKD + Windbg 调试Win10虚拟机
安装完vminstall后,先在运行中输入"msconfig"命令,显示如下窗口. 首先点击“引导”选项卡,然后选择最后一个引导项(Disable Signature Enforc ...
- COGS 615. 韩国明星
[问题描述] 在LazyCat同学的影响下,Roby同学开始听韩国的音乐,并且越来越喜欢H.o.T,尤其喜欢安七炫和Tony,可是,爱学习爱思考的Roby同学想,如果以后喜欢的韩星越来越多怎么办呢?R ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userId' not found. Available parameters are [arg1, arg0, param1, param2]
2018-06-27 16:43:45.552 INFO 16932 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : ...
- 动态规划初步--最长上升子序列(LIS)
一.问题 有一个长为n的数列 a0,a1,a2...,an-1a.请求出这个序列中最长的上升子序列的长度和对应的子序列.上升子序列指的是对任意的i < j都满足ai < aj的子序列. 二 ...
- 《3+1团队》第八次团队作业:Alpha冲刺
项目 内容 这个作业属于哪个课程 任课教师博客主页链接 这个作业的要求在哪里 作业链接地址 团队名称 3+1团队 团队博客地址 https://home.cnblogs.com/u/3-1group ...
- java HttpServletRequest 重复流读取
在用reset接口的时候,常常会使用request.getInputStream()方法,但是流只能读取一次,一旦想要加上一个过滤器用来检测用户请求的数据时就会出现异常. 在过滤器中通过流读取出用 ...
- javaEE(1)_web开发入门
一.WEB开发的相关知识 1.WEB,在英语中web即表示网页的意思,它用于表示Internet主机上供外界访问的资源. Internet上供外界访问的Web资源分为: 静态web资源(如html 页 ...
- STATIC 和 CLASS
STATIC 和 CLASS 由 王巍 (@ONEVCAT) 发布于 2015/01/28 Swift 中表示 “类型范围作用域” 这一概念有两个不同的关键字,它们分别是 static 和 class ...
- linux配置MySql表名不区分大小写
1.Linux下mysql安装完后是默认:区分表名的大小写,不区分列名的大小写:2.用root帐号登录后,在/etc/my.cnf中的[mysqld]后添加添加lower_case_table_nam ...
- Windows10系统可以禁止的服务(按名称排序)
1.Application LayerGateway Service(Windows必须禁止的10项服务) 2.Bluetooth Handsfree Service(没有蓝牙的用户可以关闭) 3.B ...