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]
- The activity loads,
- Using webdriver wait for checking if the element is clickable,
- 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
- The activity loads,
- Pushing app to background and bringing it back,
- Using webdriver wait for checking if the element is clickable,
- 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>