diff --git a/app/ios.js b/app/ios.js index 7ab12615b..cb5334143 100644 --- a/app/ios.js +++ b/app/ios.js @@ -752,7 +752,7 @@ IOS.prototype.click = function(elementId, cb) { this.executeAtom('tap', [atomsElement], cb); }, this)); } else { - var command = ["au.getElement('", elementId, "').tap()"].join(''); + var command = ["au.tapById('", elementId, "')"].join(''); this.proxy(command, cb); } }; diff --git a/app/uiauto/appium/app.js b/app/uiauto/appium/app.js index 7cf3ab47e..4511bc805 100644 --- a/app/uiauto/appium/app.js +++ b/app/uiauto/appium/app.js @@ -13,10 +13,25 @@ $.extend(au, { , mainWindow: UIATarget.localTarget().frontMostApp().mainWindow() , mainApp: UIATarget.localTarget().frontMostApp() , keyboard: function() { return UIATarget.localTarget().frontMostApp().keyboard(); } + , tapById: function(elementId, cb) { + var element = this.getElement(elementId); + if (element) { + element.tap(); + return { + status: codes.Success.code, + value: null + }; + } else { + return { + status: codes.UnknownError.code, + value: 'elementId ' + elementId + ' is null and can\'t be tapped.' + }; + } + } // Screen-related functions - , getScreenOrientation: function () { + , getScreenOrientation: function() { var orientation = $.orientation() , value = null; switch (orientation) {