//锁屏

driver.lockScreen(2);

//判断是否锁屏

driver.isLocked();

//截屏并保存至本地

File screen = driver.getScreenshotAs(OutputType.FILE);

File screenFile = new File("d:\\screen.png");

try {

    FileUtils.copyFile(screen, screenFile); //commons-io-2.0.1.jar中的api

catch (IOException e) {

    e.printStackTrace();

}

//获取当前界面的activity,可用于断言是否跳转到预期的activity

driver.currentActivity();

//打开通知栏界面

driver.openNotifications();

//获取网络状态

int status = driver.getNetworkConnection().value;

System.out.println(status);

//设置网络状态

driver.setNetworkConnection(new NetworkConnectionSetting(status));

//或者

driver.setNetworkConnection(new NetworkConnectionSetting(falsetruefalse));

//启动其他应用,跨APP
driver.startActivity("com.android.camera", ".CameraLauncher");

//自动滑动列表

driver.scrollTo("text");

//或者

driver.scrollToExact("text");

//安装APP

driver.installApp(appPath);

//判断应用是否已安装

driver.isAppInstalled("package name");

//拖动相机图标至日历图标位置

new TouchAction(driver).longPress(driver.findElementByName("相机"))

.moveTo(driver.findElementByName("日历")).release().perform();

//发送按键事件

driver.sendKeyEvent(AndroidKeyCode.HOME);

来源: http://blog.csdn.net/bear_w/article/details/50319107

补充appium -api的更多相关文章

  1. (转载)中文Appium API 文档

    该文档是Testerhome官方翻译的源地址:https://github.com/appium/appium/tree/master/docs/cn官方网站上的:http://appium.io/s ...

  2. 中文Appium API 文档

    该文档是Testerhome官方翻译的源地址:https://github.com/appium/appium/tree/master/docs/cn官方网站上的:http://appium.io/s ...

  3. 篇4 安卓app自动化测试-Appium API进阶

    篇4                 安卓app自动化测试-Appium API进阶 --lamecho辣么丑 1.1概要 大家好! 我是lamecho(辣么丑),今天是<安卓app自动化测试& ...

  4. appium API接口

    appium API接口 标签(空格分隔): appium常用api 1.contexts contexts(self) 返回当前会话的上下文,使用可以识别H5页面的控件: driver.contex ...

  5. appium(6)-parts of appium api

    parts of appium api Lock Lock the screen.//锁屏. // java driver.lockScreen(3); // objective c [driver ...

  6. Python+Appium API

    1.contextscontexts(self): Returns the contexts within the current session. 返回当前会话中的上下文,使用后可以识别H5页面的控 ...

  7. java appium api

    Appium中部分api的使用方法,有需要的朋友可以参考下. 使用的语言是java,appium的版本是1.3.4,java-client的版本是java-client-2.1.0,建议多参考java ...

  8. appium api笔记

    打印上下文driver.contexts打印当前上下文driver.contextdriver.current_context切换上下文driver.switch_to.context('WEBVIE ...

  9. appium API java

    原创内容,未经允许,禁止转载! driver.close();//关闭 driver.closeApp();//关闭应用,其实就是按home键把应用置于后台 driver.currentActivit ...

随机推荐

  1. pytonn04day

    参考: https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions 一列表 它是以[ ]括起来, 每个元素⽤用 ...

  2. HDU 6345:子串查询(前缀和)

    子串查询 Time Limit: 3500/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Sub ...

  3. 读书笔记--More Effective C++--效率(总结)

    PS: 本文只是总结,具体内容需要去查看More Effective C++--效率部分. 1. 80—20准则 大约 20%的代码使用了 80%的程序资源:大约 20%的代码耗用了大约 80%的运行 ...

  4. Python 3.5 in win10 pip install Orange3

    http://www.lfd.uci.edu/%7Egohlke/pythonlibs/ 下载Orange3 以及 依赖包 注意网页上标出的Orange 的依赖,以及 https://github.c ...

  5. java.lang.IllegalArgumentException: An invalid domain [.test.com] was specified for this cookie

    https://blog.csdn.net/cml_blog/article/details/52135115 当项目中使用单点登录功能时,通常会使用cookie进行信息的保存,这样就可以在多个子域名 ...

  6. 在使用 interface 声明一个接口时,只可以使用那个修饰符修饰该接口?

    这是一个看似简单其实挺有深意的题目,答案应该大多数人都知道是什么,不过原理和原因相比很少有人仔细研究过.对于本题,我有三点说明,希望看到这个评论的人能从这三点中看到你以前没注意到的东西:  ①接口的声 ...

  7. 黑马-ssh

    插件 Struts-plugin.xml 说明: Struts-plugin.xml文件是在tomcat服务器启动的时候加载的 该配置文件在classpath的根目录下 在每一个含有plugin字母的 ...

  8. mongodb添加验证用户 删除用户

    1.创建用户 db.createUser( { user:<name_string>,                   #字符串 pwd:<password_string> ...

  9. linux服务器进程信息查看命令

    #lsof 列出当前系统打开文件,常与-i选项使用,用于查看某个端口被哪个程序占用 [root@bogon ~]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE ...

  10. day3 python学习

    ---恢复内容开始--- 运算 在Python中有很多种运算方法,我们在这里只是先说比较运算,逻辑运算,赋值运算,算数运算 在这里要记住 ==  判断两个值是否相等  是比较运算符 >= 是否大 ...