UIAutomation????iOS?????????
???????????? ???????[ 2013/4/2 12:02:21 ] ????????
??????????????
??????????????????????Щ????????????????????????e????tap()????????????????
var tabBar = UIATarget.localTarget().frontMostApp().tabBar();
var tabButton = tabBar.buttons()["First"];
// Tap the tab bar !
tabButton.tap();
?????????????UIAButtons??doubleTap()??twoFingerTap()??????????????????????????????????????????????????????в????????????????
?????? ?????
UIATarget.localTarget().tap({x:100?? y:200});
UIATarget.localTarget().doubleTap({x:100?? y:200});
UIATarget.localTarget().twoFingerTap({x:100?? y:200});
?????? ?????
UIATarget.localTarget().pinchOpenFromToForDuration({x:20?? y:200}??{x:300?? y:200}??2);
UIATarget.localTarget().pinchCloseFromToForDuration({x:20?? y:200}?? {x:300?? y:200}??2);
?????? ?????????
UIATarget.localTarget().dragFromToForDuration({x:160?? y:200}??{x:160??y:400}??1);
UIATarget.localTarget().flickFromTo({x:160?? y:200}??{x:160?? y:400});
?????????????????????????????????????????Χ?????????????????????????????????0.5??С??60??
??????????????????????£?
????1????Instruments (⌘R)
????2????Scripts?????? ??????????
????3?????“Add > Import”??????TestAutomation/TestUI/Test-1.js?????????????浽???·????
????4?????????? (⌘R) ?????????????…
??????????Test-1.js????
var testName = "Test 1";
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
UIALogger.logStart( testName );
app.logElementTree();
//-- select the elements
UIALogger.logMessage( "Select the first tab" );
var tabBar = app.tabBar();
var selectedTabName = tabBar.selectedButton().name();
if (selectedTabName != "First") {
tabBar.buttons()["First"].tap();
}
//-- tap on the text fiels
UIALogger.logMessage( "Tap on the text field now" );
var recipeName = "Unusually Long Name for a Recipe";
window.textFields()[0].setValue(recipeName);
target.delay( 2 );
//-- tap on the text fiels
UIALogger.logMessage( "Dismiss the keyboard" );
app.logElementTree();
app.keyboard().buttons()["return"].tap();
var textValue = window.staticTexts()["RecipeName"].value();
if (textValue === recipeName){
UIALogger.logPass( testName );
}
else{
UIALogger.logFail( testName );
}
??????ν?????????????????????????tab??б??????л????????tab?????????????????????“Unusually Long Name for a Recipe”?????????????????????????Щ?μ????????????UIATarget??delay(Number timeInterval) ??????????????????????????Щ?????UIALogger??logMessage( String message) ??????????????????????????????????UIALogger??logPass(String message)????????????????????????????????
?????????????η???????????????????????????
app.keyboard().buttons()["return"].tap();
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11