Swipe gesture:
this performs a swipe gesture in the object:
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});
Drag in actionSheet: since i could not choose the specific item in the actionSheet while it is hidden in the actionSheet , however if you drag to an item and then tapping on, it easily helps you in advance by screen interaction:
target.dragFromToForDuration({x: xpoint , y: ypoint},{x: xpoint, y: ypoint},0.5);
and somehow i'm not sure just only success after getting xpoint and ypoint by:
xpoint = app.actionSheet().tableViews()[0].cells()[itemName].rect().origin.x.toString();
ypoint = app.actionSheet().tableViews()[0].cells()[itemName].rect().origin.y.toString();
UIALogger.logMessage("xpoint" + xpoint+": ypoint" + ypoint);
Using device keyboard:
var keyBoard=application.keyboard(); var keys = keyBoard.keys();
var keybuttons = keyBoard.buttons();
keybuttons.firstWithName("go").tap();
keybuttons.firstWithName("enter").tap(); keys.firstWithName("g").tap(); target.delay(0.5); keys.firstWithName("o").tap(); target.delay(0.5); keys.firstWithName("r").tap(); target.delay(0.5); keys.firstWithName("d").tap(); target.delay(0.5); keys.firstWithName("o").tap(); target.delay(0.5);
References:
http://confluence.gordonturner.ca/display/NOTES/UIAutomation+notes
https://gist.github.com/839512
http://stackoverflow.com/questions/5250201/ios-ui-automation-uiaactionsheet-does-not-have-possibilities-to-manipulate-with/5260362#5260362
http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/
http://blog.essencework.com/post/1713949516/xcode-uiautomation-for-test-result-report-part-1
http://answers.oreilly.com/topic/1646-how-to-use-uiautomation-to-create-iphone-ui-tests/
http://stackoverflow.com/questions/4859842/need-help-automate-iphone-keyboard-input-throught-javascript
http://alexvollmer.com/posts/2010/10/17/assert-yourself/
Chào bạn Duc,
ReplyDeleteTôi rất quan tâm đến blog của bạn. Nó thật sự hưu ích cho kiến thức của tôi.
Hiện tôi đang dùng: UIAutomation test cho iOS
Và đang gặp vấn đề khi move qua page kế tiếp. Tôi đang sử dụng: hàm dragFromToForDuration để chuyển sang page kế tiếp (vi dụ: target.dragFromToForDuration({x:221.00, y:224.00}, {x:122.00, y:229.00}, 0.6);). Nhưng ko phải lúc nào câu lệnh này cũng hoạt động.
Bạn có cách nào good hơn giúp mình với.
Rất cám ơn
Nguyen yen Ninh
xin email về: nguyen.yen.ninh@quantic.com.vn