#7 楼 @chenhengjie123
我发现 fruitstrap 跟 ifuse 的安装会起冲动,如果系统中不安装 ifuse 就没问题,如果安装了 ifuse,就会导致 fruitstrap 的命令无法检测或者报错,如上面提到的那样。
主要是在通过 appium 启动测试应用时,会用到 fruitstrap,所以没办法更改用 ios-deploy
#5 楼 @chenhengjie123
我的设备 udid 是:
124531c7df6aec70b297ba79bdb2232c522e41a
输入命令后:
PPdeMacBook:fruitstrap yunfeiyang$ xcodebuild -showsdks
OS X SDKs:
OS X 10.9 -sdk macosx10.9
OS X 10.10 -sdk macosx10.10
iOS SDKs:
iOS 8.1 -sdk iphoneos8.1
iOS Simulator SDKs:
Simulator - iOS 8.1 -sdk iphonesimulator8.1
可以看的出来,我的设备已经连接电脑了,可以在 itunes 中可以看得到我插入的设备。
#3 楼 @chenhengjie123
为什么 ./fruitstrap -b /Users/yunfeiyang/Downloads/AppInstall.app 命令找出来的(found device)设备 UDID 跟我当前连接电脑的设备的 UDID 不一样呢?
下面找出来的两个 UDID 都不是跟我当前所连接的设备的 UDID 一样。
------ Install phase ------
[....] Waiting for iOS device to be connected
[ 0%] Found device (7a04b819614dd6238888c90accebc0c6a6435612), beginning install
Assertion failed: (AMDeviceStartService(device, CFSTR("com.apple.afc"), &afcFd, NULL) == 0), function handle_device, file fruitstrap.c, line 488.
------ Install phase ------
[....] Waiting for iOS device to be connected
[ 0%] Found device (acdb587858d0619c05953f2209b04b3a6b86326b), beginning install
Assertion failed: (AMDeviceStartService(device, CFSTR("com.apple.afc"), &afcFd, NULL) == 0), function handle_device, file fruitstrap.c, line 488.
Abort trap: 6
public static void swipeScreen(Double startX, Double startY, Double endX,
Double endY, Double duration, int repeat, IOSDriver driver) {
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, Double> swipeObj = new HashMap<String, Double>();
swipeObj.put("startX", startX);
swipeObj.put("startY", startY);
swipeObj.put("endX", endX);
swipeObj.put("endY", endY);
for (int i = 0; i < repeat; i++) {
try {
js.executeScript("mobile: flick", swipeObj);
} catch (Exception ex) {
System.out.println("滑动屏幕失败");
}
}
}
#14 楼 @mzl19860128 把 swipe 换成 flick
#1 楼 @chenhengjie123 其实不是,那是 fruitstrap 在检测是否安装 。beginning check App is installed!
感谢分享!
第一个参数中 View view 中,View 类型怎么设定?
表个态,希望 testerhome 越来越好,人气超旺
加油,系统 TesterHome 会越办越好、
我是做 IOS 测试开发的
我也想加入
虽然支持中文,但是中文输入不会触发点击的事件,导致输入框的内容是直接 send 过去的,会让一些输入框输入之后,点击不了发送
#11 楼 @wanglha 按照方向滑动的就不行的啦?你解决了没?
public static void scrollMultiTest(String direction, int repeat,AppiumDriver driver) {
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", direction);
for (int i = 0; i < repeat; i++) {
try {
js.executeScript("mobile:scroll", scrollObject);
} catch (WebDriverException ex) {
System.out.println("滑动失败");
}
}
}