Unable to find next element after selecting the value from android spinner(drop down) and driver.getPageSource() is getting stuck

Console.txt (3.6 KB)
Appium_Log.txt (815.3 KB)

Sometimes, element not found just after selecting the value from spinner.

Code to reproduce:

package com;

import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class Ampower {

AndroidDriver<?> driver;

public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    Ampower ampower = new Ampower();
    for(int i=0; i<6; i++) {
        ampower.setUp();
        ampower.login();
        ampower.createPraposal();
    }
}

public void setUp() throws Exception {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("deviceName", "Pixel 2 API 27");
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
    capabilities.setCapability(CapabilityType.VERSION, "8.1.0");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("appPackage", "com.amhi.ampower");
    capabilities.setCapability("appActivity", "com.amhi.ampower.MainActivity");
    capabilities.setCapability("noReset", true);
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
    //        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");

    driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

public void login() throws Exception {
    Thread.sleep(5000);
    driver.findElement(By.id("offlinePinTxt")).sendKeys("1234");
    driver.findElement(By.xpath("(//android.view.View)[1]")).click();
    driver.findElement(By.id("okBtn")).click();
}

public void createPraposal() throws Exception {
    Thread.sleep(2000);
    driver.findElement(By.xpath("//android.view.View[@content-desc='New Proposals']")).click();
    driver.findElement(By.id("age")).sendKeys("32");
    driver.findElement(By.id("Mumbai")).click();
    driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@text,'Delhi')]")).click();
    driver.findElement(By.id("Year")).sendKeys("3");       ** Sometimes element year not found**
    driver.findElement(By.xpath("//android.view.View[@content-desc='I stay in']")).click();
    driver.findElement(By.xpath("(//android.view.View[@content-desc=\"Y\"])[5]")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("registerBtn")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ok")).click();
    Thread.sleep(2000);
    driver.findElement(By.id("Title")).click();
    driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@text,'Mr.')]")).click();
    Thread.sleep(5000);
    driver.findElement(By.id("nameTxt")).sendKeys("Deepak");   ** Sometimes element year not found**
    driver.findElement(By.id("dobTxt")).click();
    driver.findElement(By.xpath("(//android.view.View[@content-desc='6'])[1]")).click();
    driver.findElement(By.id("maritalStatus")).click();
    driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@text,'Married')]")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("contactNoTxt")).sendKeys("01124242424");
    Thread.sleep(5000);
    driver.quit();
}

}

And if, i use getPageSource() method for page load, AppiumDriver get stuck on getPageSource() method.

Please help…
And find attached appium log and exception msg.

Anyone has an idea to resolve this issue. I am also facing the same issue.
Appium version i used is - 1.6.1 as well as 1.8.2-beta.