????λ?????????? >> ??????????
Appium Android Bootstrap?????????????????
???????????? ???????[ 2014/12/23 16:08:54 ] ?????????????????? Appium
????2. Action??CommandHandler???????
??????????????????????????action????????????????????????‘click’????????????????????е????????????????????????????????????е?????????AndroidCommandExecutor???????????HashMap map?????????飺
class AndroidCommandExecutor {
private static HashMap<String?? CommandHandler> map = new HashMap<String?? CommandHandler>();
static {
map.put("waitForIdle"?? new WaitForIdle());
map.put("clear"?? new Clear());
map.put("orientation"?? new Orientation());
map.put("swipe"?? new Swipe());
map.put("flick"?? new Flick());
map.put("drag"?? new Drag());
map.put("pinch"?? new Pinch());
map.put("click"?? new Click());
map.put("touchLongClick"?? new TouchLongClick());
map.put("touchDown"?? new TouchDown());
map.put("touchUp"?? new TouchUp());
map.put("touchMove"?? new TouchMove());
map.put("getText"?? new GetText());
map.put("setText"?? new SetText());
map.put("getName"?? new GetName());
map.put("getAttribute"?? new GetAttribute());
map.put("getDeviceSize"?? new GetDeviceSize());
map.put("scrollTo"?? new ScrollTo());
map.put("find"?? new Find());
map.put("getLocation"?? new GetLocation());
map.put("getSize"?? new GetSize());
map.put("wake"?? new Wake());
map.put("pressBack"?? new PressBack());
map.put("pressKeyCode"?? new PressKeyCode());
map.put("longPressKeyCode"?? new LongPressKeyCode());
map.put("takeScreenshot"?? new TakeScreenshot());
map.put("updateStrings"?? new UpdateStrings());
map.put("getDataDir"?? new GetDataDir());
map.put("performMultiPointerGesture"?? new MultiPointerGesture());
map.put("openNotification"?? new OpenNotification());
map.put("source"?? new Source());
map.put("compressedLayoutHierarchy"?? new CompressedLayoutHierarchy());
}
|
???????map?????????????pc???????????action??????????????action???????????????Щ????CommandHandler???????????????????????CommandHandler????????execute?????????????????
???????????action??????AndroidElement???????????UiObject el?????????????????????
????UiDevice????action??????UiDevice???????
????UiScrollable????action??????UiScrollable???????
????UiAutomator??5????????е?action???????InteractionController??????????????QueryController???????á????????????UiAutomator??????????????????????????????????????????????????????????UiAutomator??????????????
???????????????compressedLayoutHierarchy
???????action??CommandHandler??????????????????????AndroidCommandExecutor??execute?????У?
???????????action??????AndroidElement???????????UiObject el?????????????????????
????UiDevice????action??????UiDevice???????
????UiScrollable????action??????UiScrollable???????
????UiAutomator??5????????е?action???????InteractionController??????????????QueryController???????á????????????UiAutomator??????????????????????????????????????????????????????????UiAutomator??????????????
???????????????compressedLayoutHierarchy
???????action??CommandHandler??????????????????????AndroidCommandExecutor??execute?????У?
public AndroidCommandResult execute(final AndroidCommand command) {
try {
Logger.debug("Got command action: " + command.action());
if (map.containsKey(command.action())) {
return map.get(command.action()).execute(command);
} else {
return new AndroidCommandResult(WDStatus.UNKNOWN_COMMAND??
"Unknown command: " + command.action());
}
} catch (final JSONException e) {
Logger.error("Could not decode action/params of command");
return new AndroidCommandResult(WDStatus.JSON_DECODER_ERROR??
"Could not decode action/params of command?? please check format!");
}
}
|
????????????????AndroidCommand????????json?????action??????????
????????????????map?????action?????CommandHandler?????????????
??????????????????????execute??????????????
????3. ?????????
?????????????????????getText???action?????CommandHandler?????????AndroidElement?????????????????????
????????????????map?????action?????CommandHandler?????????????
??????????????????????execute??????????????
????3. ?????????
?????????????????????getText???action?????CommandHandler?????????AndroidElement?????????????????????
public class GetText extends CommandHandler {
/*
* @param command The {@link AndroidCommand} used for this handler.
*
* @return {@link AndroidCommandResult}
*
* @throws JSONException
*
* @see io.appium.android.bootstrap.CommandHandler#execute(io.appium.android.
* bootstrap.AndroidCommand)
*/
@Override
public AndroidCommandResult execute(final AndroidCommand command)
throws JSONException {
if (command.isElementCommand()) {
// Only makes sense on an element
try {
final AndroidElement el = command.getElement();
return getSuccessResult(el.getText());
} catch (final UiObjectNotFoundException e) {
return new AndroidCommandResult(WDStatus.NO_SUCH_ELEMENT??
e.getMessage());
} catch (final Exception e) { // handle NullPointerException
return getErrorResult("Unknown error");
}
} else {
return getErrorResult("Unable to get text without an element.");
}
}
}
|
????????????????????AndroidCommand??getElement??????
????????????????AndroidCommand????????pc???????json????????’params‘???????’elementId'
??????????????id???????????????Appium Android Bootstrap??????????AndroidElement????????????AndroidElement???????
?????????????AndroidElement????????getText??????
?????????????AndroidElement??????UiObject????????getText???????????????
????4. С??
????bootstrap?????appium??pc??????????json?????????????ж????
????cmd: ???????action???????shutdown
????action??????????action????????????action??????click
????params:??????????Щ????????????????????AndroidElementHash????????????????????'elementId'
????????????json????????????
????AndroidCommandExecutor?????AndroidCommand????????????action
????????action?map???????????????????CommandHandler??????????????
??????????????????execute?????????????
????????????????AndroidCommand????????pc???????json????????’params‘???????’elementId'
??????????????id???????????????Appium Android Bootstrap??????????AndroidElement????????????AndroidElement???????
?????????????AndroidElement????????getText??????
?????????????AndroidElement??????UiObject????????getText???????????????
????4. С??
????bootstrap?????appium??pc??????????json?????????????ж????
????cmd: ???????action???????shutdown
????action??????????action????????????action??????click
????params:??????????Щ????????????????????AndroidElementHash????????????????????'elementId'
????????????json????????????
????AndroidCommandExecutor?????AndroidCommand????????????action
????????action?map???????????????????CommandHandler??????????????
??????????????????execute?????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Appium ??????????Appium iOS 10 ??????Appium+Python????????????????Appium??????????Appium????????й?BugAppium+nodeJS??????????дAppium ????????????????Appium Test Case-Python?Appium?????????λ????appium??ν????ζ?????apk?????Appium????????????????Appium??????????????appium???????????????Appium?в???api????÷???Appium??????Appium+Python??????в???demo?????
???·???
??????????????????
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????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????