Fix null tap

This commit is contained in:
bootstraponline
2013-04-30 12:53:22 -04:00
parent 35cbac4195
commit 52cd94bacc
2 changed files with 17 additions and 2 deletions

View File

@@ -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);
}
};

View File

@@ -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) {