chore: Provide a better driver load failure description
MODIFY
lib/appium.js
lib/appium.js
@@ -210,8 +210,11 @@ class AppiumDriver extends BaseDriver {
automationNameCap = driverSelector(caps);
}
}
- automationNameCap = automationNameCap.toLowerCase();
+ automationNameCap = _.toLower(automationNameCap);
+ let failureVerb = 'find';
+ let suggestion = 'Please check your desired capabilities';
+ if (_.isPlainObject(DRIVER_MAP[automationNameCap])) {
try {
const {driverPackage, driverClassName} = DRIVER_MAP[automationNameCap];
const driver = require(driverPackage)[driverClassName];
@@ -219,16 +222,18 @@ class AppiumDriver extends BaseDriver {
driver,
version: this.getDriverVersion(driver.name, driverPackage),
};
- } catch (ign) {
- // error will be reported below, and here would come out as an unclear
- // problem with destructuring undefined
+ } catch (e) {
+ log.debug(e);
+ failureVerb = 'load';
+ suggestion = 'Please verify your Appium installation';
+ }
}
const msg = _.isString(caps.automationName)
- ? `Could not find a driver for automationName '${caps.automationName}' and platformName ` +
- `'${caps.platformName}'.`
- : `Could not find a driver for platformName '${caps.platformName}'.`;
- throw new Error(`${msg} Please check your desired capabilities.`);
+ ? `Could not ${failureVerb} a driver for automationName '${caps.automationName}' and platformName ` +
+ `'${caps.platformName}'`
+ : `Could not ${failureVerb} a driver for platformName '${caps.platformName}'`;
+ throw new Error(`${msg}. ${suggestion}`);
}
getDriverVersion (driverName, driverPackage) {

chore: Provide a better driver load failure description (#13815)