1.Appium是什么?
Appium是一个跨平台移动端自动化测试工具,可以便捷的为ios和Android平台创建自动化测试用例。
模拟app内部各种操作,点击、滑动、文本输入等,手工操作的动作appium都能完成。
ios设备:appium使用UIAutomation实现驱动
Android设备:使用UIAutomator和Selendroid来实现驱动。 2.启动Appium,监听4723端口。

3.配置Android手机通过数据线和运行的Appium的PC相连,打开手机端USB调试功能确保可以连接到手机。

adb在上一节已经配置安装完成(参照上一节)。

cmd输入adb命令测试连接情况:  adb devices -l  (连接成功如下图所示,我用的是小米5x)

这里获取的连接信息配置要用到。

4.Appium内置驱动打开App,点击Appium 中搜索符号,如图进入配置界面配置Desired Capabilities 参数

platformName:平台名称

deviceName:设备名称

appPackage:app程序包名

appActivity:入口Activity名,通常以.开头

5.点击保存

6.点击 start session,就可以启动Android 手机上的微信app并进入启动页面,但是我这里出现了一个问题报了一个错误。

appium界面情况:
[Appium] Welcome to Appium v1.9.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 11 ms - 40
[HTTP]
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 3 ms - 40
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1541407442906 (16:44:02 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] appActivity: .ui.LauncherUI
[Appium] appPackage: com.tencent.mm
[Appium] deviceName: MI_5X
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":".ui.Launche...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: 1ec2b612-50a3-4a7c-b830-6cdd026cf0e4
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[BaseDriver] Event 'newSessionStarted' logged at 1541407443065 (16:44:03 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Command 'java' not found. Is it installed?
[MJSONWP] at ChildProcess. (C:\Users\vm510\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:39:14)
[MJSONWP] at ChildProcess.emit (events.js:182:13)
[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
[MJSONWP] at onErrorNT (internal/child_process.js:406:16)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:63:19)
[HTTP] <-- POST /wd/hub/session 500 164 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 8 ms - 57
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1541407449259 (16:44:09 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] appActivity: .ui.LauncherUI
[Appium] appPackage: com.tencent.mm
[Appium] deviceName: MI_5X
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":".ui.Launche...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: aad85d91-1bb2-465e-8e3c-e0cd1a4c12c4
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[BaseDriver] Event 'newSessionStarted' logged at 1541407449271 (16:44:09 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Command 'java' not found. Is it installed?
[MJSONWP] at ChildProcess. (C:\Users\vm510\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:39:14)
[MJSONWP] at ChildProcess.emit (events.js:182:13)
[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
[MJSONWP] at onErrorNT (internal/child_process.js:406:16)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:63:19)
[HTTP] <-- POST /wd/hub/session 500 16 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 1 ms - 57
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1541407492319 (16:44:52 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] appActivity: .ui.LauncherUI
[Appium] appPackage: com.tencent.mm
[Appium] deviceName: MI_5X
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":".ui.Launche...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: 1eef1933-beb8-40d3-bf1f-d58fa8b266bf
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[BaseDriver] Event 'newSessionStarted' logged at 1541407492348 (16:44:52 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Command 'java' not found. Is it installed?
[MJSONWP] at ChildProcess. (C:\Users\vm510\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:39:14)
[MJSONWP] at ChildProcess.emit (events.js:182:13)
[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
[MJSONWP] at onErrorNT (internal/child_process.js:406:16)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:63:19)
[HTTP] <-- POST /wd/hub/session 500 31 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 2 ms - 57
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1541407700506 (16:48:20 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] appActivity: .ui.LauncherUI
[Appium] appPackage: com.tencent.mm
[Appium] deviceName: MI_5X
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":".ui.Launche...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: 7de96b9a-4680-420e-bdee-d8c9619f12b6
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[BaseDriver] Event 'newSessionStarted' logged at 1541407700532 (16:48:20 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Command 'java' not found. Is it installed?
[MJSONWP] at ChildProcess. (C:\Users\vm510\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:39:14)
[MJSONWP] at ChildProcess.emit (events.js:182:13)
[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
[MJSONWP] at onErrorNT (internal/child_process.js:406:16)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:63:19)
[HTTP] <-- POST /wd/hub/session 500 30 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 1 ms - 57
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1541407780059 (16:49:40 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] appActivity: .ui.LauncherUI
[Appium] appPackage: com.tencent.mm
[Appium] deviceName: MI_5X
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":".ui.Launche...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: a53170dd-299c-4767-81f8-b6999ef40638
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[BaseDriver] Event 'newSessionStarted' logged at 1541407780083 (16:49:40 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Command 'java' not found. Is it installed?
[MJSONWP] at ChildProcess. (C:\Users\vm510\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:39:14)
[MJSONWP] at ChildProcess.emit (events.js:182:13)
[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
[MJSONWP] at onErrorNT (internal/child_process.js:406:16)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:63:19)
[HTTP] <-- POST /wd/hub/session 500 27 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 1 ms - 57
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":".ui.LauncherUI","appPackage":"com.tencent.mm","deviceName":"MI_5X","platformName":"Android","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1541408028828 (16:53:48 GMT+0800 (中国标准时间))
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] appActivity: .ui.LauncherUI
[Appium] appPackage: com.tencent.mm
[Appium] deviceName: MI_5X
[Appium] platformName: Android
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":".ui.Launche...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: 26f601d9-0b75-4b0a-8f11-2a43dfc53112
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[BaseDriver] Event 'newSessionStarted' logged at 1541408028848 (16:53:48 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Command 'java' not found. Is it installed?
[MJSONWP] at ChildProcess. (C:\Users\vm510\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:39:14)
[MJSONWP] at ChildProcess.emit (events.js:182:13)
[MJSONWP] at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
[MJSONWP] at onErrorNT (internal/child_process.js:406:16)
[MJSONWP] at process._tickCallback (internal/process/next_tick.js:63:19)
[HTTP] <-- POST /wd/hub/session 500 23 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 1 ms - 57
[HTTP]
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 2 ms - 40
[HTTP]
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 1 ms - 40
[HTTP]

8.Appium的基本使用-1的更多相关文章

  1. Appium移动自动化框架

    引言:Appium 是一个移动端自动化测试开源工具,可以针对不同的平台用一套API来编写测试用例.本文对Appium自动化测试框架的功能进行了概括. 本文选自<软件自动化测试开发>. Ap ...

  2. appium+robotframework环境搭建

    appium+robotframework环境搭建步骤(Windows系统的appium自动化测试,只适用于测试安卓机:ios机需要在mac搭建appium环境后测试) 搭建步骤,共分为3部分: 一. ...

  3. Appium python API 总结

    Appium python api 根据testerhome的文章,再补充一些文章里面没有提及的API [TOC] [1]find element driver 的方法 注意:这几个方法只能通过sel ...

  4. Appium scroll 滑动查找

    首先看uiautomator如何实现滑动查找 UiScrollable scrollView = new UiScrollable(new UiSelector().className("a ...

  5. Appium+python的一个简单完整的用例

    最近一直在忙,终于有时间来整理一下,传一个简单的用例,运行之后可以看到用例的报告,希望对大家有帮助. HTMLTestRunner这个包网上有很多,大家可以自己下载. 1 import unittes ...

  6. Appium环境搭建+cordova

    1.安装JDK 配置JAVA_HOME(变量值为jdk的安装目录)以及Path path值如下: 验证是否生效 2.安装node.js 选择适合自己的版本官网直接下载https://nodejs.or ...

  7. Appium简单测试用例

    工程目录如下: 封装初始化androiddriver 方法 import org.openqa.selenium.remote.DesiredCapabilities; import java.io. ...

  8. appium常用方法整理

    1.相对坐标解锁九宫格 应用场景 QQ解锁屏幕如上,可见九个按键在同一个View下面,要实现解锁,用press   moveTo  release  perform方法 实现代码如下: WebElem ...

  9. appium 滑动

    前些日子,配置好了appium测试环境,至于环境怎么搭建,参考:http://www.cnblogs.com/tobecrazy/p/4562199.html   知乎Android客户端登陆:htt ...

  10. Appium 三种wait方法(appium 学习之改造轮子)

    前些日子,配置好了appium测试环境,至于环境怎么搭建,参考:http://www.cnblogs.com/tobecrazy/p/4562199.html   知乎Android客户端登陆:htt ...

随机推荐

  1. IIS webService 并发 性能

    IIS webService 并发 性能     做的WebService,客户压力测试500并发(随机步长60s-90s),响应速度不理想. 1,优化程序,压缩执行时间2,提高IIS“最大工作进程数 ...

  2. TouchSlide 插件参数

    TouchSlide 可以说是 SuperSlide 手机简化版,不同的地方在于: 1.TouchSlide是纯javascript开发的,不依赖任何js库,鉴于此,TouchSlide调用方法和Su ...

  3. Winfrom控件使用

    1.Lablelable添加图片,解决图片和字体重叠? Text属性添加足够空格即可,显示效果如下所示: 2.根据窗体名称获取窗体并显示到指定panel? Label item = sender as ...

  4. Ubuntu 14.10 下Hadoop代码编译问题总结

    问题1  protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionExceptio ...

  5. C++进阶小结

    1.C++中类的不同存储区的对象的初始值 class test; class test { private: int i; int j; public: int geti() { return i; ...

  6. RPM安装MYSQL5.7

    RPM安装MYSQL5.7 1:YUM安装依赖库 yum install perl libaio numactl 2:下载安装需要的RPM包 https://dev.mysql.com/get/Dow ...

  7. [UE4]迁移小地图到其他工程

    一.创建一个新工程,类型不限,本次测试场创建的是赛车类工程. 二.为了方便管理,最好在All文件文件夹下新建一个名为MiniMap的目录,并把所有小地图相关的都放进来. 三.在小地图工程中,右键Rou ...

  8. linux下的进程信息管理

  9. join、on、where、having的使用区别

    on.where.having的区别 on.where.having这三个都可以加条件的子句中,on是最先执行,where次之,having最后.on是在生成中间的临时表时起作用的,where,hav ...

  10. mdm9607 gpio12~17改成普通gpio的方法

    qualcomm mdm9607的gpio12~gpio17定义如下: 现在如果想要设置GPIO_12~GPIO_17为普通GPIO口. 需要修改如下: 顺便附上qualcomm的说明: Remove ...