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的更多相关文章

  1. [uiautomator篇][1] 官网译文

    http://www.jianshu.com/p/7718860ec657 2016.07.25 20:59 字数 3675 Android UIAutomator浅谈 --------------- ...

  2. [uiautomator篇] python uiautomatorDemo

    #coding=utf-8 """ @version: 1.0 @author: @prerequisite: based on Python 2.7 @usage: 1 ...

  3. [uiautomator篇][exist 存在,但click错误]

    uiautomator定位页面元素是,定位存在的;但是click的时候,发现点的位置不对,(不知道是android系统的问题还是uiautomator的问题,初步怀疑是系统的问题)

  4. [uiautomator篇] 使用uiautomator需要导入uiautomator库

    1 修改依赖文件:build/gradle( 是在app目录下)而不是和app同级目录的build/gradle androidTestCompile 'com.android.support.tes ...

  5. [Uiautomator篇][2] UiDeviceAPI介绍

    1 https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html  http://www.cnb ...

  6. [UiAutomator篇][3] 打开音乐应用的测试脚本

    package qq.test; import android.content.Context; import android.content.Intent; import android.suppo ...

  7. [uiautomator篇] 找父亲节点和其他兄弟节点

    https://testerhome.com/topics/1250 Appium [已解决] UiSelector 如何根据节点定位到父节点 / 兄弟节点? liqing380 · 发布于 2014 ...

  8. [uiautomator篇] uiautoviewer 定位不到元素

    定位工具: Uiautomatorviewer 在我们的APP中,只有这一个页面,元素无法加载出来,其它的都没有什么问题.   提示的错误:Error while obtaining UI hiera ...

  9. [uiautomator篇] 获取当前页面的方法

    Uiautomator 在2.0之前的版本里就提供了getCurrentActivity()的方法,但返回内容不正确:2.0 版本今天尝试了下,还是返回有问题的: 有点没描述清楚啊,是在uiautom ...

随机推荐

  1. Java之内部类、包及代码块

    个人通俗理解: 1.内部类:有点类似于写在父类中的子类,根据位置不一样为不同的名字,和相应的访问方式不同:不过要访问外部类的话,需要充分运用好this(本类)的这个关键字:要是需要快速的创建子类对象的 ...

  2. Spring Cloud Config git版

    由于在学习这块内容的时候还不会使用gitHub所以就用了osc的码云 config server POM文件 <dependency> <groupId>org.springf ...

  3. 解决 Cocos2d-x 3.2 error C1041: 无法打开程序数据库vc120.pdb

    单个项目解决方案 解决方案是为项目添加 /FS (Force Synchronous PDB Writes) 编译选项,具体位置在: 一劳永逸的解决方案 直接修改cocos的项目模板templates ...

  4. Android线程池(转)

    .前言 转载请注明出处:http://blog.csdn.net/seu_calvin/article/details/52415337 使用线程池可以给我们带来很多好处,首先通过线程池中线程的重用, ...

  5. SVN客户端--TortoiseSVN使用说明

    TortoiseSVN是windows下其中一个非常优秀的SVN客户端工具.通过使用它,我们可以可视化的管理我们的版本库.不过由于它只是一个客户端,所以它不能对版本库进行权限管理. TortoiseS ...

  6. Java中常见编码格式及乱码解决方法

    一:设置编码格式 1.JSP文件 charset=UTF-8 的作用是指定JSP向客户端输出的编码方式为"UTF-8",pageEncoding="UTF-8" ...

  7. LR常用函数汇总

    lr_start_transaction为性能分析标记事务的开始 lr_end_transaction为性能分析标记事务的结束 lr_rendezvous在 Vuser 脚本中设置集合点 lr_thi ...

  8. Clown without borders 2017/1/9

    原文 Taking laughter to those who need it most "When will you all return again?"the Croatian ...

  9. 如何计算CDS view里两个时间戳之间的天数间隔

    ABAP透明表里的时间戳,数据类型为dec: 有个需求:计算这两个时间戳之间的天数间隔,丢弃时间戳年-月-日8位后面的小时:分钟:秒. 举个例子:如果时间戳是20180918173132,丢弃1731 ...

  10. Servlet The Filter

    The Filter Filter不会产生Request或者是Response, 但是会在两者访问资源时, 对其作出改变.其可以作用于静态资源和动态资源. LifeCycle Filter会和Serv ...