appium-uiauto
Advanced tools
Comparing version 1.6.7 to 1.6.10
{ | ||
"name": "appium-uiauto", | ||
"version": "1.6.7", | ||
"version": "1.6.10", | ||
"description": "appium uiauto ios driver", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -9,3 +9,2 @@ /* globals $, env */ | ||
type === "UIATextView" || type === "UIASearchBar") { | ||
// do the full-on clear,keyboard typing operation | ||
if (this.hasKeyboardFocus() === 0) { | ||
@@ -91,8 +90,6 @@ this.tap(); | ||
UIAElement.prototype.text = function () { | ||
var type = this.type(); | ||
if (type === "UIAButton") { | ||
return this.label(); | ||
} else { | ||
return this.value(); | ||
} | ||
var label = this.label(); | ||
var value = this.value(); | ||
if (label) return label; | ||
return value; | ||
}; | ||
@@ -99,0 +96,0 @@ |
@@ -166,18 +166,33 @@ /* globals $ */ | ||
var _formatPredicate = function (targetName, contains) { | ||
targetName = targetName || ""; | ||
if (typeof targetName !== 'string') { | ||
throw new Error("You must supply a string for an element predicate search."); | ||
} | ||
// escape unescaped single and double quotation marks and return a predicate condition | ||
// string in the format 'name VERB "TARGET" || label VERB "TARGET"'. | ||
var verb = contains ? 'contains[c]' : '=='; | ||
var comparison = verb + ' "' + targetName.replace(/\\?['"]/g, "\\$&") + '"'; | ||
return 'name ' + comparison + ' || label ' + comparison; | ||
}; | ||
UIAElement.prototype.getWithName = function (targetName, onlyVisible) { | ||
return this.getFirstWithPredicate("name == '" + targetName + "' || label == '" + targetName + "'", onlyVisible); | ||
return this.getFirstWithPredicate(_formatPredicate(targetName, false), onlyVisible); | ||
}; | ||
UIAElement.prototype.getAllWithName = function (targetName, onlyVisible) { | ||
return this.getAllWithPredicate("name == '" + targetName + "' || label == '" + targetName + "'", onlyVisible); | ||
return this.getAllWithPredicate(_formatPredicate(targetName, false), onlyVisible); | ||
}; | ||
UIAElement.prototype.getNameContains = function (targetName, onlyVisible) { | ||
return this.getFirstWithPredicate("name contains[c] '" + targetName + "' || label contains[c] '" + targetName + "'", onlyVisible); | ||
return this.getFirstWithPredicate(_formatPredicate(targetName, true), onlyVisible); | ||
}; | ||
UIAElement.prototype.getAllNameContains = function (targetName, onlyVisible) { | ||
return this.getAllWithPredicate("name contains[c] '" + targetName + "' || label contains[c] '" + targetName + "'", onlyVisible); | ||
return this.getAllWithPredicate(_formatPredicate(targetName, true), onlyVisible); | ||
}; | ||
})(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13372906
3491