diff --git a/lib/commands/find.js b/lib/commands/find.js index 8b6ed2af..d9fb037f 100644 --- a/lib/commands/find.js +++ b/lib/commands/find.js @@ -35,7 +35,17 @@ helpers.findElOrEls = async function (strategy, selector, mult, context = '') { try { element = await this.doFindElementOrEls(params); } catch (err) { - if (err instanceof errors.NoSuchElementError) { + + // if the error that comes back is from a proxied request, we need to + // unwrap it to its actual protocol error first + if (_.isFunction(err.getActualError)) { + err = err.getActualError(); // eslint-disable-line no-ex-assign + } + + // now we have to inspect the error to determine if it is a no such + // element error, based on the shape of the error object from + // appium-base-driver + if (err.jsonwpCode === 7 || err.error === "no such element") { // we are fine with this, just indicate a retry return false; } diff --git a/package.json b/package.json index 7ac28900..9235c7f5 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "appium-adb": "^6.8.0", "appium-android-bootstrap": "^2.11.0", "appium-android-ime": "^2.0.0", - "appium-base-driver": "^2.26.0", + "appium-base-driver": "^2.32.1", "appium-chromedriver": "^4.0.0", "appium-support": "^2.13.0", "appium-unlock": "^2.0.0",