Unable to click on EditText field which is not in focus

I have a situation like I am automating a native app using Appium(1.3.7) and Selenium webdriver (2.44) in that I want to enter the Date of birth field, when I am clicking on Date of birth field, it will pop up a window to enter the date of birth details, that window is not in focus and appium is failing to enter the details on the window as it is not able to recognize here I am attaching the screenshot of the elements.

Please help me how to get in to focus and enter the Date of birth details… Using Google I tried a lot of methods like:

List<WebElement> Listed= dr.findElementsByClassName("android.widget.EditText");

   for(int i=0; i <=Listed.size()-1;i++){
   System.out.println("EditText Number="+i);
   Listed.get(i).sendKeys("10");

Method :2

    WebElement Touch1= dr.findElement(By.xpath("//*[@class='android.widget.EditText']"));
//    
       TouchAction action = new TouchAction(dr);
       action.press(Touch1);
       action.waitAction(300);
       action.perform();

Method : 3

dr.tap(168,440,405,591);

Method : 4

WebElement DOBsample = dr.findElementByXPath("//*[text()[contains(.,'20')]]");
DOBsample.click();

Method :5

dr.sendKeyEvent(66);

Screen shot :

<img src="/uploads/default/918/7636953119f8e99c.jpg" width="625" height="500">

What kind of screen is the pop up? It would be helpful if you could use the Inspector or ARC to look at the elements on that screen.

I ask what kind of screen because in my testing if I get an ‘alert’ (Full disclosure: I mainly work on iOS) I have to call:

apm.driver.switch_to.alert

Before I can dismiss/accept the alert. Maybe something similar in this case?

Could you please post the date picker control tree layout expanded (a snapshot) I think date picker control is under Linear Layout but it would be good to see details of the date picker control itself.

@wreed

Here i used the appium inspector and attached the screenshot…and i dint find any type i,e whether its an alert window or an frame to switch over , please help me if you find , am attaching the screenshot, and i used appium inspector this time as you suggested and i dint find any change for appium inspector and uiautomatorviewer.

@Umar_Khan

Hi…i attached the screenshot with whole elements layout with expanded view, kindly please check and suggest me a solution

In my opinion you should be able to click on the field. Just try following steps:

  1. launch app
  2. click on DOB field
  3. find the text field on popup
  4. click on the element

you can implement these steps in a method. Try it ans also send the appium logs.

@Umar_Khan

Hi,

Thanks for the reply i solved the issue by changing “APPIUMDRIVER” to “REMOTEWEBDRIVER”

this is AppiumDriver