//
锁屏
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(
false
,
true
,
false
));
//启动其他应用,跨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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。