appium-uiauto
Advanced tools
Comparing version 0.0.16 to 0.0.17
{ | ||
"name": "appium-uiauto", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "appium uiauto ios driver", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,2 +9,12 @@ /* globals codes, $ */ | ||
UIAElement.prototype.getFirstWithPredicateWeighted = function (predicate) { | ||
var elems = this.getElementsWithPredicateWeighted(predicate); | ||
return au._returnFirstElem($(elems)); | ||
}; | ||
UIAElement.prototype.getAllWithPredicateWeighted = function (predicate) { | ||
var elems = this.getElementsWithPredicateWeighted(predicate); | ||
return au._returnElems($(elems)); | ||
}; | ||
UIAElement.prototype.getElementsWithPredicateWeighted = function (predicate) { | ||
var target = UIATarget.localTarget(); | ||
@@ -24,2 +34,3 @@ target.pushTimeout(0); | ||
var children = element.elements(); | ||
var allElements = []; | ||
if (isNil(results)) { | ||
@@ -40,3 +51,3 @@ results = element.textFields().withPredicate(search); | ||
if (tmp.isVisible() === 1) { | ||
return tmp; | ||
allElements.push(result); | ||
} | ||
@@ -49,22 +60,17 @@ } | ||
if (result.type() !== 'UIAElementNil' && result.isVisible() === 1) { | ||
return result; | ||
allElements.push(result); | ||
} | ||
} | ||
return result; | ||
return allElements; | ||
}; | ||
var element = searchElements(this); | ||
var elements = searchElements(this); | ||
var newElements = []; | ||
for (var i = 0; i < elements.length; i++) { | ||
if (newElements.indexOf(elements[i]) === -1) { | ||
newElements.push(elements[i]); | ||
} | ||
} | ||
target.popTimeout(); | ||
if (element.type() === 'UIAElementNil') { | ||
return { | ||
status: 7, | ||
value: {'message': 'An element could not be located on the page using the given search parameters.'} | ||
}; | ||
} | ||
return { | ||
status: 0, | ||
value: {ELEMENT: au.getId(element)} | ||
}; | ||
return newElements; | ||
}; | ||
@@ -357,2 +363,28 @@ | ||
, _getIdSearchPredicate: function (sel, exact) { | ||
if (exact) { | ||
return "name == '" + sel + "' || label == '" + sel + "' || value == '" + | ||
sel + "'"; | ||
} else { | ||
return "name contains[c] '" + sel + "' || label contains[c] '" + sel + | ||
"' || value contains[c] '" + sel + "'"; | ||
} | ||
} | ||
, getElementById: function (sel) { | ||
var exactPred = this._getIdSearchPredicate(sel, true); | ||
var exact = this.mainApp().getFirstWithPredicateWeighted(exactPred); | ||
if (exact && exact.status === 0) { | ||
return exact; | ||
} else { | ||
var pred = this._getIdSearchPredicate(sel, false); | ||
return this.mainApp().getFirstWithPredicateWeighted(pred); | ||
} | ||
} | ||
, getElementsById: function (sel) { | ||
var pred = this._getIdSearchPredicate(sel, false); | ||
return this.mainApp().getAllWithPredicateWeighted(pred); | ||
} | ||
, _returnFirstElem: function (elems) { | ||
@@ -359,0 +391,0 @@ if (elems.length > 0) { |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances 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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 6 instances in 1 package
2546
4
94802
24