Merge pull request #784 from bootstraponline/776

Fix #776
This commit is contained in:
bootstraponline
2013-06-18 13:45:36 -07:00
3 changed files with 20 additions and 20 deletions
@@ -79,8 +79,8 @@ public class Find extends CommandHandler {
.get("strategy"));
final String contextId = (String) params.get("context");
if (strategy == Strategy.SEARCH_ID) {
Logger.debug("Searching id.");
if (strategy == Strategy.XML_VALUE) {
Logger.debug("Searching XML values (id values).");
final String target = params.get("selector").toString().toLowerCase();
@SuppressWarnings("unchecked")
final Iterator<String> iterator = apkStrings.keys();
@@ -93,8 +93,8 @@ public class Find extends CommandHandler {
}
}
return getSuccessResult(results);
} else if (strategy == Strategy.SEARCH_VALUE) {
Logger.debug("Searching value.");
} else if (strategy == Strategy.XML_KEY) {
Logger.debug("Searching XML keys (id names).");
final String target = params.get("selector").toString().toLowerCase();
@SuppressWarnings("unchecked")
final Iterator<String> iterator = apkStrings.keys();
@@ -8,8 +8,8 @@ public enum Strategy {
CLASS_NAME(0, "class name"), CSS_SELECTOR(1, "css selector"), ID(2, "id"), NAME(
3, "name"), LINK_TEXT(4, "link text"), PARTIAL_LINK_TEXT(5,
"partial link text"), TAG_NAME(6, "tag name"), XPATH(7, "xpath"), DYNAMIC(
8, "dynamic"), SEARCH_ID(9, "search id"), RESOLVE_ID(10, "resolve id"), SEARCH_VALUE(
11, "search value");
8, "dynamic"), RESOLVE_ID(9, "resolve id"), XML_KEY(10, "xmlKeyContains"), XML_VALUE(
11, "xmlValueContains");
public static Strategy fromString(final String text) {
if (text != null) {
+14 -14
View File
@@ -336,24 +336,24 @@ exports.find = function(req, res) {
}
};
exports.searchId = function(req, res) {
var strategy = "search id"
, selector = req.body;
req.device.findElements(strategy, selector, getResponseHandler(req, res));
};
exports.searchValue = function(req, res) {
var strategy = "search value"
, selector = req.body;
req.device.findElements(strategy, selector, getResponseHandler(req, res));
};
exports.resolveId = function(req, res) {
var strategy = "resolve id"
, selector = req.body;
req.device.findElements(strategy, selector, getResponseHandler(req, res));
};
exports.xmlKeyContains = function(req, res) {
var strategy = "xmlKeyContains"
, selector = req.body;
req.device.findElements(strategy, selector, getResponseHandler(req, res));
};
exports.xmlValueContains = function(req, res) {
var strategy = "xmlValueContains"
, selector = req.body;
req.device.findElements(strategy, selector, getResponseHandler(req, res));
};
exports.mobileSwipe = function(req, res) {
req.body = _.defaults(req.body, {
touchCount: 1
@@ -857,8 +857,8 @@ var mobileCmdMap = {
, 'fireEvent': exports.fireEvent
, 'source': exports.mobileSource
, 'find': exports.find
, 'searchId': exports.searchId
, 'searchValue': exports.searchValue
, 'xmlValueContains': exports.xmlValueContains
, 'xmlKeyContains': exports.xmlKeyContains
, 'resolveId': exports.resolveId
, 'waitForPageLoad': exports.waitForPageLoad
, 'currentActivity': exports.getCurrentActivity