Appium - iOS 各种问题汇总
2014-10-28 17:27
411 查看
Appium - iOS 各种问题汇总
作者: Max.Bai
时间: 2014/10
Appium - iOS 各种问题汇总
第一种:swipe
X,Y可为coordinator,也可以是percent,大于1 为coordinator, 小于1 为percent,比如0.5 代表50%
duration单位为秒, Android 可以设置0.1-60,iOS设置0.5-60
需要滑动特定的对象时需要指定的element,只是在名目上滑动式就可以不指定element
第二种: flick 区别swipe是没有duration
第三种: scroll only for iOS scrollViewscroll方向滑动:
方向接受参数:Right, Left, Up, Down
重要:方向和我们认为的方向相反,比如要向下滑,就用Up,应为Up的意思是滑动到手机的顶部,左右也是一样,左滑就是Right
scroll对象滑动:
Android可以设置如下cap来输入中文,同时能达到隐藏键盘的效果,但是这个设置只能针对Android。
iOS 就必须掉用方法hideKeyboard()
默认是点非输入框的地方键盘自动隐藏,如果不生效(开发没有做这个效果),就需要使用其他方法,比如:通过点击“Done”来隐藏键盘
Appium 1.3 对应Xcode6.0
可能出现错误:
Error: Could not find Automation.tracetemplate
Error: Could not find ios simulator binary at /application/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator
mac 版本更换命令,修改成自己版本对应的路径就好了:
可以试用setvalue代替
但是在iOS里面使用模拟器返回值总是false,没有错误信息,后来查看源代码发现
cb(new Error("You can not call isInstalled for the iOS simulator!"));
同样removeApp/installApp 都是
官网说明如下:
app The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first. e.g.: /abs/path/to/my.apk or http://myapp.com/app.ipa
我为了方便集中管理安装程序所以使用了http://sssss/x.zip
坑爹的问题来了,Android根本就不支持,报错找不到提供的app
iOS 还好,可以安装,但是测试中发现好多控件和放在本地完全不是一个效果。。。
所以还是老老实实的使用本地设置吧
ps: 貌似1.3解决了Android http 的问题,还没有验证
Appium will not work if used or installed with sudo
网上有高人解决了这个问题
过程如下:
步骤1. 改变node的所有者
cd /usr/local/lib
sudo chown -R bixiaopeng node_modules
步骤2. 卸载appium
npm uninstall appium -g
步骤3. 重新安装appium
npm install -g appium
步骤4. 启动
appium
原链接:http://blog.csdn.net/wirelessqa/article/details/29188665
不管app的还是ipa的都要区分模拟器版本和真机版本
对于模拟器的,app的Appium不用解压,直接安装,ipa的Appium会解压找出app然后安装,问题来了,Appium用的解压工具是unzip,如果你的ipa里面包含中文的文件名,估计要出问题了,这个是unzip的老问题,网上有方案,不在这里说了,最简单的就是使用app的包,不用解压。
对于真机的,目前还没有测试,后续有问题会更新。
作者: Max.Bai
时间: 2014/10
Appium - iOS 各种问题汇总
1. Appium 滑动:
swipe 有三种方式:第一种:swipe
JavascriptExecutor js = (JavascriptExecutor) driver; WebElement element = driver.findElementByXPath("xpath"); HashMap<String, Double> swipeObject = new HashMap<String, Double>(); swipeObject.put("startX", startX); swipeObject.put("startY", startY); swipeObject.put("endX", endX); swipebject.put("endY", endY); swipeObject.put("duration", duration); swipeObject.put("element", Double.valueOf(((RemoteWebElement) element).getId())); js.executeScript("mobile: swipe", swipeObject);
X,Y可为coordinator,也可以是percent,大于1 为coordinator, 小于1 为percent,比如0.5 代表50%
duration单位为秒, Android 可以设置0.1-60,iOS设置0.5-60
需要滑动特定的对象时需要指定的element,只是在名目上滑动式就可以不指定element
第二种: flick 区别swipe是没有duration
JavascriptExecutor js = (JavascriptExecutor) driver; WebElement element = driver.findElementByXPath("xpath"); HashMap<String, Double> flickObject = new HashMap<String, Double>(); flickObject.put("startX", 0.8); flickObject.put("startY", 0.5); flickObject.put("endX", 0.2); flickObject.put("endY", 0.5); flickObject.put("element", Double.valueOf(((RemoteWebElement) element).getId())); js.executeScript("mobile: flick", flickObject);
第三种: scroll only for iOS scrollViewscroll方向滑动:
JavascriptExecutor js = (JavascriptExecutor) _driver; HashMap<String, String> scrollObject = new HashMap<String, String>(); scrollObject.put("direction", sDrection); js.executeScript("mobile: scroll", scrollObject);
方向接受参数:Right, Left, Up, Down
重要:方向和我们认为的方向相反,比如要向下滑,就用Up,应为Up的意思是滑动到手机的顶部,左右也是一样,左滑就是Right
scroll对象滑动:
JavascriptExecutor js = (JavascriptExecutor) driver; WebElement element = driver.findElementByXPath("scrollview中元素的xpath"); HashMap<String, String> scrollObject = new HashMap<String, String>(); scrollObject.put("element", ((RemoteWebElement) element).getId()); js.executeScript("mobile: scroll", scrollObject);
2. 隐藏键盘hideKeyboard()
为了避免输入框输入内容后键盘遮挡控件,需要对键盘隐藏Android可以设置如下cap来输入中文,同时能达到隐藏键盘的效果,但是这个设置只能针对Android。
capabilities.setCapability("unicodeKeyboard", true); capabilities.setCapability("resetKeyboard", true);
iOS 就必须掉用方法hideKeyboard()
默认是点非输入框的地方键盘自动隐藏,如果不生效(开发没有做这个效果),就需要使用其他方法,比如:通过点击“Done”来隐藏键盘
hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
3. Xcode 版本
Appium 1.2.* 对应Xcode5.0Appium 1.3 对应Xcode6.0
可能出现错误:
Error: Could not find Automation.tracetemplate
Error: Could not find ios simulator binary at /application/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator
mac 版本更换命令,修改成自己版本对应的路径就好了:
sudo xcode-select -switch /Applications/Xcode-4.6.app/Contents/Developer/
4. Sendkeys vs setValue
Sendkeys iOS无法输入可以试用setvalue代替
((MobileElement)_driver.findElement(by)).setValue(sText);
5. isAppInstalled/removeApp/installApp
isAppInstalled这个方法在Android里面可以使用(模拟器和真机都试过)但是在iOS里面使用模拟器返回值总是false,没有错误信息,后来查看源代码发现
cb(new Error("You can not call isInstalled for the iOS simulator!"));
同样removeApp/installApp 都是
6. App path 设置
官网说可以用remote URL设置cap 的app官网说明如下:
app The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first. e.g.: /abs/path/to/my.apk or http://myapp.com/app.ipa
我为了方便集中管理安装程序所以使用了http://sssss/x.zip
坑爹的问题来了,Android根本就不支持,报错找不到提供的app
iOS 还好,可以安装,但是测试中发现好多控件和放在本地完全不是一个效果。。。
所以还是老老实实的使用本地设置吧
ps: 貌似1.3解决了Android http 的问题,还没有验证
7. sudo安装Appium后无法启动
sudo npm install -g appium后果Appium will not work if used or installed with sudo
网上有高人解决了这个问题
过程如下:
步骤1. 改变node的所有者
cd /usr/local/lib
sudo chown -R bixiaopeng node_modules
步骤2. 卸载appium
npm uninstall appium -g
步骤3. 重新安装appium
npm install -g appium
步骤4. 启动
appium
原链接:http://blog.csdn.net/wirelessqa/article/details/29188665
8. App or IPA ?
刚开始都想基于开始测试,发现怎么都是不行,不管App,和ipa格式的,现在我总结了一下分享给大家。不管app的还是ipa的都要区分模拟器版本和真机版本
对于模拟器的,app的Appium不用解压,直接安装,ipa的Appium会解压找出app然后安装,问题来了,Appium用的解压工具是unzip,如果你的ipa里面包含中文的文件名,估计要出问题了,这个是unzip的老问题,网上有方案,不在这里说了,最简单的就是使用app的包,不用解压。
对于真机的,目前还没有测试,后续有问题会更新。
相关文章推荐
- Appium - iOS 各种问题汇总
- Appium - iOS 各种问题汇总
- Appium - iOS 各种问题汇总
- 升级到Xcode 5.1和iOS 7遇到的各种问题及解决办法汇总:
- 升级到Xcode 5.1和iOS 7遇到的各种问题及解决办法汇总:
- 初学IOS遇到的各种问题汇总
- 升级到Xcode 5.1和iOS 7遇到的各种问题及解决办法汇总:
- appium上调试ios真机的各种问题
- ios 编程日记 :内存问题汇总
- ubuntu11.10下opencv的各种问题小汇总
- IIS部署WCF出现的各种问题汇总
- ios打包IPA的各种问题和解决方法
- IOS 各种问题收藏贴
- 各种蛋疼配置问题汇总
- iPhone开发笔记(21)iOS 6旋转问题解决方法汇总
- IOS开发错误问题汇总(更新中)
- ubuntu12.04安装sqldeveloper及各种问题汇总
- 各种乱码问题汇总
- 由于升级iOS版本导致证书丢失等一系列问题汇总
- 【Android】Intent 页面跳转问题以及 会跳刷新 等各种问题汇总