您的位置:首页 > 移动开发

appium测试ios应用遇到的问题

2016-01-05 18:17 417 查看
1、在真机上跑APPIUM,需要指定udid,如果机子已安装ipa应用则app参数用bundle id,如果未安装,app参数使用app的路径

appium -U UDID --app Bundle ID

1)模拟器的服务端配置(如果使用ios模拟器,需要源码编译安装,而且app参数需要指定ipa应用路径):



然后切换Advanced中勾选Use Native Instruments Library

客户端desired_caps配置

desired_caps_ios={'platformVersion':'9.2',

'deviceName':'iphone6',

'app':'/user/library/XXX.ipa',

'platformName':'IOS',

}

2)真机的服务端配置(如果是真机,需要指定udid):



客户端desired_caps配置
desired_caps_ios={'platformVersion':'8.1',

'deviceName':'iphone',

'app':'com.500.coyote.',

'platformName':'IOS',

}

2、启动app遇到crash(两种情况)

(1)selenium.common.exceptions.WebDriverException: Message: u'A new session could not be created. (Original error: Instruments crashed on startup)'

是因为developer选项里的 Enable UI Automation木有开启,开启后就OK了。在真机上跑APPIUM的前提是,手机连mac电脑,打开xcode就可以注册成开发者手机,这样就可以在Settings的页面看到 Developer(开发者)这个选项了。

(2)"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}

一般出现这个问题,都是你的APP的签名跟设备的不一样导致,用xcode debug重新安装一个即可。

3、Platform Version 是一个文本框,如果测试的机型版本比较高,可以自己填写版本的,注意如果是自定义版本,请勾选IOS Setting->advanceed ->Use Native Instruments Library

4、用appium inspector定位出来的type可以用class name定位,name可以用name定位,xpath用xpath定位



5、真机系统是ios9以上的,在刚安装程序第一次启动前,需要在设置-通用-描述文件与设备管理-企业级应用中找到你的程序对应文件点进去信任该应用才能启动应用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: