Log:
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
target.logElementTree();
UIALogger.logPass( "My Test" );
UIALogger.logFail( "My Test" );
Subview:
var tabBar = window.tabBar();
var tabButton = tabBar.buttons()["Second"];
tabButton.tap();
Taps:
UIATarget.localTarget().tap({x:100, y:200});UIATarget.localTarget().doubleTap({x:100, y:200});UIATarget.localTarget().twoFingerTap({x:100, y:200});
Pinches:
UIATarget.localTarget().pinchOpenFromToForDuration({x:20, y:200},{x:300, y:200},2);UIATarget.localTarget().pinchCloseFromToForDuration({x:20, y:200}, {x:300, y:200},2);
Drag and Flick:
UIATarget.localTarget().dragFromToForDuration({x:160, y:200},{x:160,y:400},1);UIATarget.localTarget().flickFromTo({x:160, y:200},{x:160, y:400});
Delay:
target.delay( 2 );
Keyboard:
app.keyboard().buttons()["return"].tap();
转载于:https://blog.51cto.com/techforlcl/1301495