截图功能:

//截屏并保存至本地

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

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



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

push文件、pull文件

        	File file = new File("d:\\test.txt"); //test.txt内容为"test"
String content = null;
try {
content = FileUtils.readFileToString(file);
} catch (IOException e) {
e.printStackTrace();
} byte[] data = Base64.encodeBase64(content.getBytes());
driver.pushFile("sdcard/test.txt", data); byte[] resultDate = driver.pullFile("sdcard/test.txt");
System.out.println(new String(Base64.decodeBase64(resultDate))); //打印结果为"test"
发送按键事件
driver.sendKeyEvent(AndroidKeyCode.HOME);
tap点击元素
driver.tap(1, driver.findElementByName("日期和时间"), 0);

单击坐标

如果怎么都定位不到控件,那就可以考虑坐标定位

driver.swipe(1257, 2263, 1257, 2263, 5);

driver. tap(int fingers, int x, int y, int duration) ;

Appium实现的技巧的更多相关文章

  1. appium+robotframework常见技巧总结

    1.如何输入中文 方法: 在open application参数最后,新增unicodeKeyboard=True    resetKeyboard=True:不加入这两个参数时,中文无法输入 2.如 ...

  2. appium简明教程

    appium简明教程 什么是appium? 下面这段介绍来自于appium的官网. Appium is an open-source tool you can use to automate mobi ...

  3. appium简明教程(7)——Desired Capabilities详解

    Desired Capabilities在启动session的时候是必须提供的. Desired Capabilities本质上是key value的对象,它告诉appium server这样一些事情 ...

  4. Appium教程——Desired Capabilities 详解(转自TesterHome)

    Desired Capabilities在启动session的时候是必须提供的. Desired Capabilities本质上是key value的对象,它告诉appium server这样一些事情 ...

  5. Appium教程---Client/Server Architecture

    appium的核心其实是一个暴露了一系列REST API的server. 这个server的功能其实很简单:监听一个端口,然后接收由client发送来的command.翻译这些command,把这些c ...

  6. appium知识点

    1 appium元素获取技巧 # 就是页面滑动 driver.swipe(x1, y1, x1, y2, t) # 拿到所有跟元素有关的标签,其实是个列表 driver.find_elements_b ...

  7. 【python-appium】Appium的一些坑问题错误解决 与 技巧集锦

    问题 1. error: Failed to start an Appium session, err was: Error: Requested a new session but one was ...

  8. 【待考察】Appium使用技巧,助你快速入门移动端自动化!

    Appium使用技巧,助你快速入门移动端自动化! 原创: 柠檬班superman 柠檬班软件测试 1月4日 关注并置顶[柠檬班]的小哥哥小姐姐 “猪”年行大运 说说最近研究移动端的自动化 移动端的自动 ...

  9. [Android测试] Appium的一些坑问题错误解决 与 技巧集锦

    转:https://blog.csdn.net/niubitianping/article/details/52624417 1. error: Failed to start an Appium s ...

随机推荐

  1. URLConnection调用接口

    写在前面: 项目是java web,jdk1.4,weblogic 7;对方.net系统,用wcf开发的接口.对方提供接口url地址,以及说明用post方式去调用,无需传递参数,直接返回json ar ...

  2. c#重起 普通路由器

    using DotNet.Utilities;using System;using System.Collections.Generic;using System.Linq;using System. ...

  3. mybatis和spring整合

    参考文档: http://www.cnblogs.com/jyh317/p/3834142.html http://www.cnblogs.com/xdp-gacl/p/4271627.html ht ...

  4. zookeeper初试

    实验环境: os-platform: windows7 x64 jdk: 1.7 参考文档: http://www.ibm.com/developerworks/cn/opensource/os-cn ...

  5. 优雅的封装ajax,含跨域

    之前写过一篇 先定一个小目标,自己封装个ajax,是基于原生js的,也就是jquery中ajax的简化版本实现的思路.众所周知,jquery的ajax是项目中最常用的请求后台的方式,也算是封装的很完美 ...

  6. BootLoader--改进(基于2440)

    BootLoader--改进 之前编写的Bootloader启动内核时间使用差不多7秒钟的时间,大多都是用在CPU将内核从Nandflash读取到SDRam中,故首先想到的方法是改变CPU时钟频率. ...

  7. centos7 安装elasticsearch

    [root@localhost local]# tar xzvf elasticsearch-2.3.5.tar.gz [root@localhost elasticsearch-2.3.5]# bi ...

  8. JS封闭函数、闭包、内置对象

    一.变量作用域 变量作用域指的是变量的作用范围,javascript中的变量分为全局变量和局部变量 1.全局变量:在函数之外定义的变量,为整个页面公用,函数的内部外部都可以访问. 2.局部变量:在函数 ...

  9. T4 代码生成 Demo (抽奖程序)

    参考自这位大狮的:  https://github.com/Pencroff/Dapper-DAL/blob/master/Dapper-DAL/Models/ModelGenerator.tt 项目 ...

  10. CSS外边距合并问题

    今天无意中碰到了外边距合并的问题,于是便研究了一下.这里做个笔记. 所谓外边距合并,指的是当两个垂直外边距相遇时,它们将形成一个外边距.合并后的外边距的高度等于两个发生合并的外边距的高度中的较大者. ...