使用appium进行ios测试,启动inspector时遇到的问题(一)

  最近在公司,让做ios的自动化测试,因为以前做过android的自动化测试,用的也是appium,觉得没什么,结果一开始在搭建环境就遇到了很多的问题,现在将我遇到的问题,以及解决方法,给大家分享出来。(ps:吐槽一下testhome,发了两个帖子一个提问帖一个心得分享帖,全都给拉到违规区了,问题也没有人给看)

  进入正题,说一下我的环境:

  xcode 7.1.1

  simulator 9.1

  appium 1.4.13

  iphone 5s  ios9.1

  首先说一下,appium 在ios版本选择这一块最高版本到了8.4,可能大家会有疑问,我是9.1没有选项怎么办啊。

  这个问题提很好解决,大家仔细看看,在设置中那个文本框是可以手动输入,可以键盘输入的啊,输入之后记得勾选 下面设置 IOS Setting->advanceed ->Use Native       Instruments Library,或者在Developer Settings 勾选enable、Custom Server Flags 并在加入 --native-instruments-lib 请参考:https://discuss.appium.io/t/has-anyone-been-able-to-use-ios-simulator-9-1-with-appium-1-4-13/6887/8

  可能大家常见到的问题是这个,发现在启动inspector后,包也装到simulator 可是应用已一启动就闪退,这个问题是因为iOS 的不跨平台,编译时必须指定运行在 arm 还是 x86 上。具体在打包时的区别是使用的 sdk 不同。解决这个问题就是直接使用xcode将包安装在手机虚拟机上,然后在启动inspector就可以了。(这里我有个问题,但我选择使用bundleID启动时,提示我找不到包。而使用app path 发现包已经安装,就不会再次从新安装,会直接启动已经安装的包)

  在使用虚拟手机测试的过程中,在使用sendkeys调起输入法的时候,可能会报错:‘An error occurred while executing user supplied JavaScript 这个问题我只有在虚拟手机上遇到过,真机测试时没有遇到过这种情况。可能是不能调起输入法造成的。

  下面说一下使用真机启动inspector时,遇到的问题,真机启动遇到问题,先贴个log

  info: [debug] [INST STDERR] 2015-12-11 17:54:01.261 instruments[10308:11044258] WebKit Threading Violation - initial use of WebKit from a secondary thread.

  info: [debug] [INST STDERR] 2015-12-11 17:54:07.289 instruments[10308:11044422] Attempting to change event horizon while disengage

  info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 3.) : Failed to launch process with bundle identifier ‘com.zipingfang.1‘
  info: [debug] [INST STDERR] 2015-12-11 17:54:07.289 instruments[10308:11044241] Attempting to change event horizon while disengage

  info: [debug] [INSTSERVER] Instruments exited with code 253
  info: [debug] Killall instruments
  info: [debug] Instruments crashed on startup
  info: [debug] Attempting to retry launching instruments, this is retry #1
  info: [debug] Killall iOS Simulator

没错就是 Instruments crashed 这个问题直到今天我才解决了,使用真机进行ios测试要注意以下几点:

参考:https://discuss.appium.io/t/ios-instruments-crashed-on-startup/1191/14

1.要有开发者账号

2.设备已经被添加至开发者设备

3.使用xcode debug 安装应用至手机
4.描述文件中 信任此应用的证书
5.在手机设置 -开发者中 勾选 使用UI Automation.

会继续更新,如果不对欢迎指正

 

 

 

 

 

  

文章来自:http://www.cnblogs.com/llining/p/5040290.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3