title: Appium tests worked in our app's previous release, but don't all work in our app's new release
body: <p>When we ran our appium tests in our 2.4.0 release they were working with a 100% passing rate. However, with our new release 2.5.0, some of the tests are failing.</p>
  
  <p>They are failing because on some of the screens they can't locate an element. The ids of the elements are exactly the same in 2.5.0 as they were in 2.4.0.</p>
  
  <p>I have made sure that it is waiting for the screen to load. What happens is it will go through a few screens then always get stuck on the same screen and sit there for the timeout period I have set and then fail saying it was unable to locate the element.</p>
  
  <p>Here are the appium logs of when the test gets to the enter name screen. It should find the first name field, and send text.</p>
  
  <pre><code>&gt; [debug] [MJSONWP] Calling AppiumDriver.findElement() with args:
  &gt; ["id","Step3.firstname","489801e6-96d8-45f8-9712-0c2ec940413b"]
  &gt; [debug] [BaseDriver] Valid locator strategies for this request: xpath,
  &gt; id, class name, accessibility id, -android uiautomator [debug]
  &gt; [BaseDriver] Waiting up to 0 ms for condition [debug]
  &gt; [AndroidBootstrap] Sending command to android:
  &gt; {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Step3.firstname","context":"","multiple":false}}
  &gt; [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from
  &gt; client:
  &gt; {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Step3.firstname","context":"","multiple":false}}
  &gt; [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type
  &gt; ACTION [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command
  &gt; action: find [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug]
  &gt; Finding 'Step3.firstname' using 'ID' with the contextId: '' multiple:
  &gt; false [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[INSTANCE=0,
  &gt; RESOURCE_ID=com.readytouchpos.smallstore:id/Step3.firstname] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[INSTANCE=0, RESOURCE_ID=android:id/Step3.firstname] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[INSTANCE=0, RESOURCE_ID=Step3.firstname] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[DESCRIPTION=Step3.firstname, INSTANCE=0] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element.
  &gt; Clearing Accessibility cache and retrying. [debug] [AndroidBootstrap]
  &gt; [BOOTSTRAP LOG] [debug] Finding 'Step3.firstname' using 'ID' with the
  &gt; contextId: '' multiple: false [debug] [AndroidBootstrap] [BOOTSTRAP
  &gt; LOG] [debug] Using: UiSelector[INSTANCE=0,
  &gt; RESOURCE_ID=com.readytouchpos.smallstore:id/Step3.firstname] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[INSTANCE=0, RESOURCE_ID=android:id/Step3.firstname] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[INSTANCE=0, RESOURCE_ID=Step3.firstname] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
  &gt; UiSelector[DESCRIPTION=Step3.firstname, INSTANCE=0] [debug]
  &gt; [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result:
  &gt; {"status":7,"value":"No element found"} [debug] [AndroidBootstrap]
  &gt; Received command result from bootstrap [debug] [MJSONWP] Matched
  &gt; JSONWP error code 7 to NoSuchElementError [debug] [MJSONWP]
  &gt; Encountered internal error running command: NoSuchElementError: An
  &gt; element could not be located on the page using the given search
  &gt; parameters. [debug] [MJSONWP]     at AndroidDriver.callee$0$0$
  &gt; (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
  &gt; [debug] [MJSONWP]     at tryCatch
  &gt; (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
  &gt; [debug] [MJSONWP]     at GeneratorFunctionPrototype.invoke [as
  &gt; _invoke] (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
  &gt; [debug] [MJSONWP]     at
  &gt; GeneratorFunctionPrototype.prototype.(anonymous function) [as throw]
  &gt; (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
  &gt; [debug] [MJSONWP]     at GeneratorFunctionPrototype.invoke
  &gt; (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
  &gt; [debug] [MJSONWP]     at &lt;anonymous&gt;
  </code></pre>
  
  <p>Here is the method used to send keys to the first name field:</p>
  
  <pre><code>&gt; public EnterNameScreen typeFirstName(String firstName){
  &gt;         waitForElement(firstNameTextBox).sendKeys(firstName);
  &gt;         return this;
  &gt;     }
  </code></pre>
  
  <p>Here is the wait method that is being used in the typeFirstName method:</p>
  
  <pre><code>protected WebElement waitForElement(By locator) {
  
          int count = 0;
          int maxTries = 3;
          while(true) {
              try {
                  WebDriverWait wait = new WebDriverWait(driver, timeout);
                  wait.until(ExpectedConditions.visibilityOfElementLocated((locator)));
                  return driver.findElement(locator);
              } catch (Exception e) {
                  // handle exception
                  if (++count == maxTries) throw e;
              }
          }
  
      }
  </code></pre>
  
  <p>Keep in mind these were working flawlessly in our 2.4.0 release. It is only in our new release 2.5.0 that this has stopped working. Some buttons are still being clicked as expected and some fields are still getting the sent text as expected, but some like this example above are not.
  Has anyone had this happen before? Could it be a library that was updated on the app to cause this?</p>