51Testing软件测试论坛

标题: iphone自动化 [打印本页]

作者: frogwan    时间: 2012-3-16 10:41
标题: iphone自动化
有做iphone自动化的吗 想问下如何用代码滑动屏幕
作者: niunjxtest    时间: 2012-4-11 08:05
顶下。。。
作者: shanxiying    时间: 2012-4-13 10:42
关注!
作者: 马德里不思议    时间: 2012-4-17 14:19
用instrument 录一下就知道了,target.frontMostApp().mainWindow().层.控件名.scrollToVisible();
作者: moonet    时间: 2012-4-21 13:26
我一直都是用sikuli这个软件的~!直接使用图片控件~
作者: harryzhang2522    时间: 2012-4-21 15:10
关注ing。。。。
作者: frogwan    时间: 2012-5-14 09:59
Share with you.(write as JavaScript)

var target = UIATarget.localTarget();

var application = target.frontMostApp();

var mainWindow = application.mainWindow();

mainWindow.dragInsideWithOptions({startOffset:{x:0.0, y:0.0}, endOffset:{x:0.8, y:0.10}, duration:1});

The method that used to swipe the page is dragInsideWithOptions, Here are description from apple
dragInsideWithOptions
Drags within the bounds of an element.
(undefined) dragInsideWithOptions(Object options)
Parameters
options
A dictionary that specifies characteristics of the gesture. Valid keys are as follows:
touchCount        The number of touches to use in the specified gesture. (Effectively, the number of fingers a user would use to make the specified gesture.) The default touch count value is 1.
duration        The length of hold time for the specified gesture. The default duration value for a tap is 0. The default value for touch-and-hold gestures (such as drag, pinch open, and pinch close) is 1.
startOffset        The first offset to use for a multiple-point gesture. The default value is {x:0.0, y:0.0}. See the discussion for details.
endOffset        The last offset to use for a multiple-point gesture. The default value is {x:0.0, y:0.0}. See the discussion for details.
Discussion
You can use offsets to achieve finer precision in specifying the hitpoint within the rect for the specified element. The offset comprises a pair of x and y values, each ranging from 0.0 to 1.0. These values represent, respectively, relative horizontal and vertical positions within the rect, with {x:0.0, y:0.0} as the top left and {x:1.0, y:1.0} as the bottom right. Thus, {x:0.3, y:0.6} specifies a position just below and to the left of center, and {x:1.0, y:0.5} specifies a position centered vertically at the far right.
This example performs a slow drag within the target element from left edge to right edge, just below the top:
target.dragInsideWithOptions({startOffset:{x:0.0, y:0.1}, endOffset:{x:1.0, y:0.1}, duration:1.5});
作者: lby151    时间: 2012-6-29 11:45
欢迎进入179969063,扣扣群号讨论。。功能测试,手机测试,性能测试。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2