iphone自动化
有做iphone自动化的吗 想问下如何用代码滑动屏幕 顶下。。。 关注! 用instrument 录一下就知道了,target.frontMostApp().mainWindow().层.控件名.scrollToVisible(); 我一直都是用sikuli这个软件的~!直接使用图片控件~ 关注ing。。。。 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}); 欢迎进入179969063,扣扣群号讨论。。功能测试,手机测试,性能测试。
页:
[1]