Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (strategy === 'xpath' && MAGIC_FIRST_VIS_CHILD_SEL.test(selector)) {
if (mult) {
throw new Error('Cannot get multiple first children');
}
return await this.getFirstVisibleChild(context);
}
// previously getSelectorForStrategy
if (strategy === 'class name' && selector.indexOf('UIA') !== 0) {
throw new errors.InvalidSelectorError(
`The class name selector must use full UIA class names. Try 'UIA${selector}' instead.`);
}
if (!selector) new errors.InvalidSelectorError('Missing selector'); // eslint-disable-line curly
let createGetElementCommand = function (strategy, selector, mult, context) {
let ext = mult ? 's' : '';
let command = '';
context = !context ? context : `, '${context}'` ;
switch (strategy) {
case 'name':
command = `au.getElement${ext}ByName('${selector}'${context})`;
break;
case 'accessibility id':
command = `au.getElement${ext}ByAccessibilityId('${selector}'${context})`;
break;
case 'id':
command = `au.getElement${ext}ById('${selector}')`;
break;
case '-ios uiautomation':
}
if (strategy === 'xpath' && MAGIC_SCROLLABLE_SEL.test(selector)) {
return await this.findScrollableElOrEls(mult, context);
}
if (strategy === 'xpath' && MAGIC_FIRST_VIS_CHILD_SEL.test(selector)) {
if (mult) {
throw new Error('Cannot get multiple first children');
}
return await this.getFirstVisibleChild(context);
}
// previously getSelectorForStrategy
if (strategy === 'class name' && selector.indexOf('UIA') !== 0) {
throw new errors.InvalidSelectorError(
`The class name selector must use full UIA class names. Try 'UIA${selector}' instead.`);
}
if (!selector) new errors.InvalidSelectorError('Missing selector'); // eslint-disable-line curly
let createGetElementCommand = function (strategy, selector, mult, context) {
let ext = mult ? 's' : '';
let command = '';
context = !context ? context : `, '${context}'` ;
switch (strategy) {
case 'name':
command = `au.getElement${ext}ByName('${selector}'${context})`;
break;
case 'accessibility id':
command = `au.getElement${ext}ByAccessibilityId('${selector}'${context})`;
break;