Nosuchelement exception when activity is visible only on Android

Having this strange situation. My code is resulting in no such element exception in scenario 1, but in scenario 2 it’s working.

Note: This issue is only on Android, on iOS tests not having issue on login.

Scenario 1: [FAIL]

  1. The activity loads,
  2. Using webdriver wait for checking if the element is clickable,
  3. Timeout after the time limit 20 - 30 second.
    Debugging:
  • I am waiting for app to complete login on the emulator and then performed step 2. Still facing no such element exception despite of activity completely being loaded.

Scenario 2: [PASS] pusing to background

  1. The activity loads,
  2. Pushing app to background and bringing it back,
  3. Using webdriver wait for checking if the element is clickable,
  4. Element is recognized, going ahead with remaining tests.

Operating sytem:
Android - Nexus 6 emulator on Android 8.0

POM:
<testng.version>6.14.3</testng.version>
<appium.java.version>6.1.0</appium.java.version>
<apachepoi.version>3.17</apachepoi.version>
<selenium.version>3.14.0</selenium.version>
<allure.version>1.4.0.RC4</allure.version>
<aspectj.version>1.8.11</aspectj.version>
<firefox.version>3.14.0</firefox.version>
<sauceondemand.version>2.14</sauceondemand.version>
<sauceclientfactory.version>2.14</sauceclientfactory.version>
<saucetestng.version>2.1.23</saucetestng.version>
<log4j.version>1.2.17</log4j.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>

Everyone. Use an implicit wait so that the app finishes loading:

1 Like

Sorry for not being specific. I am using webdriver wait, updated the comments can you please check?