Appium [已解决](答案在评论) appium 环境搭建,模拟器中的 app 连续闪退闪开,然后模拟器就自动关闭

tomchen · 2016年06月22日 · 最后由 dd 回复于 2018年06月22日 · 2643 次阅读

**

机器配置环境是:XCode 7.3 系统 :OS X 10.11 Node.js 6.2.2

**

很感谢,各位大神的帮助,换了一个用模拟器编译的.app 文件,已经可以正常打开了。
可是问题接踵而来,用来写脚本的控制器无法自动打开。
当 app 正常打开后,启动器就一直在 “转转转” 了,然后就弹出提示。

Log:

[debug] [iOS] Instruments launched. Starting poll loop for new
commands. [debug] [iOS] Setting bootstrap config keys/values [debug]
[UIAuto] Socket data received (2 bytes)

[debug] [UIAuto] Got a result when we were not expecting one! Ignoring
it [debug] [UIAuto] Sending command to instruments: target =
$.target(); au = $; $.isVerbose = true;

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: [] [HTTP] -->
GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[debug] [Instruments] [INST] 2016-06-23 01:58:14 +0000 Debug:
evaluation finished

[debug] [Instruments] [INST] 2016-06-23 01:58:14 +0000 Debug:
responding with: [debug] [Instruments] [INST] 2016-06-23 01:58:14
+0000 Debug: Running system command #1: /Applications/Appium.app/Contents/Resources/node/bin/node
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js
/var/folders/0z/6l4x79ds0qd609sl8y71xxfh0000gn/T/instruments_sock
2,{"status":0,"v...

[debug] [UIAuto] Socket data received (27 bytes)

[debug] [UIAuto] Got result from instruments:
{"status":0,"value":true}

[debug] [iOS] Setting initial orientation to PORTRAIT [debug] [UIAuto]
Sending command to instruments: au.setScreenOrientation('PORTRAIT')

[HTTP] <-- GET /wd/hub/status - - ms - -

[HTTP] <-- GET /wd/hub/status - - ms - -

[debug] [Instruments] [INST] 2016-06-23 01:58:15 +0000 Debug: Got new
command 1 from instruments: au.setScreenOrientation('PORTRAIT')

[debug] [Instruments] [INST] 2016-06-23 01:58:15 +0000 Debug:
evaluating au.setScreenOrientation('PORTRAIT')

[debug] [Instruments] [INST] 2016-06-23 01:58:15 +0000 Debug:
target.setDeviceOrientation("1")

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: [] [HTTP] -->
GET /wd/hub/status {} [MJSONWP] Calling AppiumDriver.getStatus() with
args: []

[debug] [Instruments] [INST] 2016-06-23 01:58:16 +0000 Debug:
evaluation finished

[debug] [Instruments] [INST] 2016-06-23 01:58:16 +0000 Debug:
responding with:

[debug] [Instruments] [INST] 2016-06-23 01:58:16 +0000 Debug: Running
system command #2:
/Applications/Appium.app/Contents/Resources/node/bin/node
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js
/var/folders/0z/6l4x79ds0qd609sl8y71xxfh0000gn/T/instruments_sock
2,{"status":0,"v...

[debug] [UIAuto] Socket data received (33 bytes)

[debug] [UIAuto] Got result from instruments:
{"status":0,"value":"PORTRAIT"} [debug] [iOS] Waiting for app source
to contain elements [debug] [UIAuto] Sending command to instruments:
au.mainApp().getTreeForXML()


在点击放大镜启动模拟器后,模拟器中的 app 连续闪退闪开,然后模拟器就自动关闭,重新启动了,不断重复。
只想测试 iOS 的,所以单独之配置了 ios 所需要的环境,尝试过换低版本的模拟器,以及不同的机型,均不能处理这个问题。
如图所示:




下面是日志:

Log:

[debug] [iOSSim] Building bundle path map

[debug] [iOSSim] Building bundle path map

[debug] [iOSSim] Could not find app directories to delete. It is
probably not installed

[debug] [iOSSim] Killing any simulator daemons for
BC881B32-7B61-4F80-B22E-EE3DF18A9B32

[iOSSim] Cleaning simulator BC881B32-7B61-4F80-B22E-EE3DF18A9B32

[HTTP] <-- GET /wd/hub/status - - ms - -

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[HTTP] <-- GET /wd/hub/status - - ms - -

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[HTTP] <-- GET /wd/hub/status - - ms - -

[debug] [iOS] Not setting locale

[debug] [iOS] No iOS / app preferences to set

[debug] [iOSLog] Starting iOS 9.3 simulator log capture [debug]
[iOSLog] System log path:
/Users/mingo/Library/Logs/CoreSimulator/BC881B32-7B61-4F80-B22E-EE3DF18A9B32/system.log

[debug] [iOS] Not pre-launching simulator

[debug] [iOS] Starting UIAutoClient, and launching Instruments.

[debug] [UIAuto] Instruments socket server started at
/var/folders/0z/6l4x79ds0qd609sl8y71xxfh0000gn/T/instruments_sock

[debug] [Instruments] Instruments is at:
/Applications/Xcode.app/Contents/Developer/usr/bin/instruments [debug]
[Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments

[debug] [Instruments] Attempting to run app on iPhone 6 (9.3) [
[Instruments] On xcode 7.0+, instruments-without-delay does not work,
skipping instruments-without-delay

[debug] [Instruments] Found Insruments-Without-Delay:
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-instruments/thirdparty/iwd7

[debug] [Instruments] Spawning instruments with command:
'/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate
-D /var/folders/0z/6l4x79ds0qd609sl8y71xxfh0000gn/T/appium-instruments/instrumentscli0.trace
-w "iPhone 6 (9.3) [" /Users/mingo/Desktop/appiumtest/yitian.app -e UIASCRIPT "/Users/mingo/Library/Application
Support/appium/bootstrap/bootstrap-29011722188d9c36.js" -e
UIARESULTSPATH
/var/folders/0z/6l4x79ds0qd609sl8y71xxfh0000gn/T/appium-instruments'
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}

共收到 15 条回复 时间 点赞

这也正是我不太想用 appium 的原因,依赖的东西太多了,抱歉我帮不上忙

#1 楼 @codeskyblue 我想问问有其它比较好的自动化测试工具推荐吗?最好是 android 与 iOS 都有的

@seveniruby 大神求帮忙看看😥 😥

#3 楼 @dippa 你编译的版本不对. 得用开发者证书

楼上正解,用虚拟机版本

看我的帖子,查查是什么原因。https://testerhome.com/topics/5233

#2 楼 @dippa 我也是之前用 appium 好好的,现在遇到一个无法绕过的问题,现在转移用 tuneup_js,封装的 uiautomation 上手挺快的,就是定位很麻烦,看定位信息特别烦

查看你的 .app 文件,看里面有没有 embedded.mobileprovision 文件。如果有,那这是给真机打的包,不能在模拟器上使用。

#5 楼 @seveniruby 我换了版本,可以成功运行了。但是发现弹出来的界面,并不稳定。并且在切换界面的时候,经常出现卡死的情况,请问是不稳定的情况吗?还是我自己操作不当?

可以试一下,模拟器加载该目录下的 .app 文件,
~/Library/Developer/Xcode/DerivedData/项目名称/Build/Products/Debug-iphonesimulator

我也遇到这个问题,运行到模拟器 app 连续闪退闪开,然后模拟器就自动关闭。
我的 app 是用代码编译出来的,用的是开发证书。

用真机测试,已运行安装了该 app,也配置了 app 所在绝对路径,但是会提示应用未安装,最终安装失败。

吉米 回复

请问下后来 appium iOS 模拟器中启动 app 是闪退的情况怎么解决的呢?

请问下楼主后来 appium iOS 模拟器中启动 app 是闪退的情况怎么解决的呢?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册