appium-mac2-driver
Version:
XCTest-based Appium driver for macOS apps automation
28 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findElOrEls = findElOrEls;
const support_1 = require("appium/support");
/**
* This is needed to make lookup by image working
*
* @param strategy - The locator strategy to use
* @param selector - The selector value
* @param mult - Whether to find multiple elements
* @param context - Optional context element ID
*/
async function findElOrEls(strategy, selector, mult, context) {
const contextId = context ? support_1.util.unwrapElement(context) : context;
const endpoint = `/element${contextId ? `/${contextId}/element` : ''}${mult ? 's' : ''}`;
let normalizedStrategy = strategy;
if (strategy === '-ios predicate string') {
normalizedStrategy = 'predicate string';
}
else if (strategy === '-ios class chain') {
normalizedStrategy = 'class chain';
}
return await this.wda.proxy.command(endpoint, 'POST', {
using: normalizedStrategy,
value: selector,
});
}
//# sourceMappingURL=find.js.map