//锁屏

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. ps教程

    http://www.16xx8.com/photoshop/xinshoujiaocheng/

  2. AangularJS过滤器详解

    (参考angular权威指南) 过滤器:   用来格式化需要展示给用户的数据: 使用过滤器的方式: (1)$scope.name=$filter("lowercase").(&qu ...

  3. This Jenkins instance appears to be offline

    tomcat 方式启动jenkins时,报:This Jenkins instance appears to be offline and offers options to "Config ...

  4. 顺平讲try catch finally throw throws(精华)

    try catch finally  有点像if else语句 还有像javascript的服务器执行成功后的回调函数,success:function(){ 进行处理 }; throws的意思是将异 ...

  5. 常用C语言time时间函数

    常见的时间函数有time( ).ctime( ).gmtime( ).localtime( ).mktime( ).asctime( ).difftime( ).gettimeofday( ).set ...

  6. #pragma Directive in C/C++

    The #pragma is complier specified. for example, the code below does not work in gcc. #pragma startup ...

  7. 一次单片机 SFR 页引发的“事故”

    一次单片机 SFR 页引发的"事故" 现象 需要使用单片机的 ADC 功能,在对 ADC 初始化后,根据内部分的 IVREN 计算出 VDD 的电压值 . 在读取时一直显示 ADC ...

  8. Web-Business-Application-Solution

    项目地址 :  https://github.com/kelin-xycs/Web-Business-Application-Solution Web-Business-Application-Sol ...

  9. tomcat源码阅读之BackupManager

    一. 配置: <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOpti ...

  10. [转]HTML 简介

    HTML 实例 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <t ...