Skip to content

Commit

Permalink
fix issue in find element error handling, so implicit wait can work
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Jun 9, 2018
1 parent e0f05e9 commit 690236e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/commands/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 690236e

Please sign in to comment.