Help, help, help: In this condition, why findElementById method could not located element

My environment: APPIUM+Eclipse+Maven+Java+TestNG+ReportNG
For following mobile app login page, I have two java test cases.


Firsly run test case 1(priority = 2), no problem
test case 1: no input customer account and click login button, then pop up message box"Input account can’t be empty!", then click “Confirm” button,

Then, run test case 2(priority = 3 ),
test case 2: input customer account, password, verification code and login

But when calling first line code to automatically input customer account,

driver.findElementById(“com.tebonsc:id/edit_account”).sendKeys(“99006”);

Report following error:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 44 milliseconds

Following are two test cases:
@Test(priority = 2)
public void InputEmptyDealAccount() throws InterruptedException {

driver.findElementByXPath("//android.widget.FrameLayout[@resource-id='android:id/content']/android.widget.RelativeLayout/"
		+ "android.widget.LinearLayout/android.widget.RelativeLayout/android.view.ViewGroup/"
		+ "android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/"
		+ "android.widget.LinearLayout[2]/android.widget.LinearLayout/android.widget.ImageView").click();
Thread.sleep(5000);
driver.findElementByXPath("//android.view.View[@content-desc='please click login']").click();
Thread.sleep(5000);

//mobile verification code login
driver.findElementById("com.tebonsc:id/edit_PhoneNumber").sendKeys("13900000000");
driver.findElementById("com.tebonsc:id/image_yanzhengma").click();
Thread.sleep(5000);
driver.findElementById("com.tebonsc:id/iamge_login").click();
Thread.sleep(5000);

//customer account login
driver.findElementById("com.tebonsc:id/login").click();
Thread.sleep(5000);

String loginhint = driver.findElementByXPath("//android.widget.TextView[@text='Input account can't be empty!']").getText();
if(loginhint.contains("Input account can't be empty")) Assert.assertEquals(true, true);

driver.findElementByXPath("//android.widget.Button[@text='Confirm']").click();

Thread.sleep(5000);

//driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
Reporter.log("InputEmptyDealAccount: Pass the test of empty customer account!");

}

@Test(priority = 3)
public void LoginSuccess() throws InterruptedException {

//customer account login
driver.findElementById("com.tebonsc:id/edit_account").sendKeys("99006");
    //String str = driver.getPageSource().toString();  
//List<AndroidElement> elist = driver.findElementsByXPath("//*");

Thread.sleep(5000);
driver.findElementById("com.tebonsc:id/edit_password").sendKeys("111111");
Thread.sleep(15000);
driver.findElementById("com.tebonsc:id/login").click();
Thread.sleep(10000);

//Check login dealing account info
String dealaccount = driver.findElementByXPath("//android.view.View[@content-desc='王**']").toString();
if(dealaccount.contains("王**")) Assert.assertEquals(true, true);
String saledepart = driver.findElementByXPath("//android.view.View[@content-desc='上海凉城路证券营业部']").toString();
if(dealaccount.contains("上海凉城路证券营业部")) Assert.assertEquals(true, true);

Thread.sleep(5000);

//swipe  to Main UI of APP for later test
int width = driver.manage().window().getSize().width; 
int height = driver.manage().window().getSize().height; 
int srcwid = width-10;
int srcheight = height/2; 
driver.tap(1, srcwid, srcheight, 500);
Thread.sleep(5000);

Reporter.log("LoginSuccess: 12位客户号正常登录测试通过!");

}

I have checked the element(“com.tebonsc:id/edit_account”), name is right by uiautomatorviewer tool. Anybody know the reason?

I found that after running test case 1, then in test case 2, all elements can’t be located.

I do some try and find that:
If I put the following code before the code( driver.findElementById(“com.tebonsc:id/login”).click(); ) in test case 1
driver.findElementById(“com.tebonsc:id/edit_account”).sendKeys(“99006”);

Then the element can be located, and no exception. I don’t know why? Anybody could help me.