diff --git a/lib/devices/ios/ios-controller.js b/lib/devices/ios/ios-controller.js index 3bd144905..ebc461235 100644 --- a/lib/devices/ios/ios-controller.js +++ b/lib/devices/ios/ios-controller.js @@ -40,6 +40,7 @@ iOSController.createGetElementCommand = function (strategy, selector, ctx, many) { var ext = many ? 's' : ''; var command = ""; + ctx = !ctx ? ctx : ", '" + ctx + "'" ; switch (strategy) { case "name": helpers.logDeprecationWarning("Locator Strategy", '"name"', @@ -82,7 +83,6 @@ iOSController.findUIElementOrElements = function (strategy, selector, ctx, many, ctx = ''; } else if (typeof ctx === "string") { ctx = escapeSpecialChars(ctx, "'"); - ctx = ", '" + ctx + "'"; } try {