diff --git a/lib/driver.js b/lib/driver.js index 4230503ed..740cc16af 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -834,16 +834,20 @@ class XCUITestDriver extends BaseDriver { errorMsg += `. Make sure you follow the tutorial at ${WDA_REAL_DEV_TUTORIAL_URL}`; } if (this.opts.usePreinstalledWDA) { - // In case the bundle id process start got failed because of - // auth popup in the device. Then, the bundle id process itself started. It is safe to stop it here. - await this.mobileKillApp(this.wda.bundleIdForXctest); + try { + // In case the bundle id process start got failed because of + // auth popup in the device. Then, the bundle id process itself started. It is safe to stop it here. + await this.mobileKillApp(this.wda.bundleIdForXctest); + } catch (ign) {}; // Mostly it failed to start the WDA process as no the bundle id // e.g. ' not found on device ' - throw new Error( - `Unable to launch WebDriverAgent. Original error: ${err.message}. ` + - `Make sure the application ${this.wda.bundleIdForXctest} exists and it is launchable. ` + - `${WDA_REAL_DEV_TUTORIAL_URL} may help to complete the preparation.`, - ); + + errorMsg = `Unable to launch WebDriverAgent. Original error: ${err.message}. ` + + `Make sure the application ${this.wda.bundleIdForXctest} exists and it is launchable.`; + if (this.isRealDevice()) { + errorMsg += ` ${WDA_REAL_DEV_TUTORIAL_URL} may help to complete the preparation.`; + }; + throw new Error(errorMsg); } else { await quitAndUninstall(errorMsg); }