博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
8.Appium的基本使用-1
阅读量:6627 次
发布时间:2019-06-25

本文共 14202 字,大约阅读时间需要 47 分钟。

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]

 

posted on
2018-11-05 16:56 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/lvjing/p/9910067.html

你可能感兴趣的文章
BZOJ 2456: mode(新生必做的水题)
查看>>
View State
查看>>
自旋锁spinlock解析
查看>>
【java.lang.UnsupportedClassVersionError】版本不一致出错
查看>>
Ubuntu16.04 安装RabbitMQ
查看>>
javascript游戏引擎
查看>>
JVM Debugger Memory View for IntelliJ IDEA
查看>>
LINUX下GDB反汇编和调试
查看>>
golang fmt格式“占位符”
查看>>
SpringMVC包括哪些组件
查看>>
现代前端开发路线图:从零开始,一步步成为前端工程师
查看>>
Oracle绝对值函数
查看>>
mysql 的mgr集群
查看>>
html5播放mp4视频代码
查看>>
032_nginx配置文件安全下载
查看>>
Linux下tomcat修改成的80端口无法访问
查看>>
Kubernetes 集群日志管理 - 每天5分钟玩转 Docker 容器技术(180)
查看>>
redis实现对账(集合比较)功能
查看>>
为了好好看球,学霸们用深度学习重建整个比赛3D全息图
查看>>
浅谈持续集成
查看>>