Fix iOS callback problem after finding an element by a wrong id

This commit is contained in:
Ruben Gonzalez Alonso
2014-05-09 11:22:19 +02:00
parent fa5e3f5a30
commit e73b60e354
2 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -88,7 +88,7 @@ iOSController.findUIElementOrElements = function (strategy, selector, ctx, many,
try {
selector = this.getSelectorForStrategy(strategy, selector);
} catch (e) {
cb(null, {
return cb(null, {
status: status.codes.UnknownError.code
, value: e
});
@@ -230,7 +230,12 @@ iOSController.getSelectorForStrategy = function (strategy, selector) {
var newSelector = selector;
if (strategy === "id") {
var strings = this.localizableStrings;
if (strings && strings.length >= 1) newSelector = strings[0][selector];
if (strings && strings.length >= 1) {
newSelector = strings[0][selector];
if (!newSelector) {
throw new TypeError("Id selector not found in Localizable.strings.");
}
}
}
if (strategy === 'class name') {
if (selector.indexOf('UIA') !== 0) {