Android : How to hit search key after entering zip code in text field

I am trying to automate one search functionality in android native app. User can search from zip code,city,state name

The User has to enter zip code and hit search icon on android native keyboard .

Am able to enter zip code but not search . Tried below code for same nothing worked.

search is webelement here

search.sendKeys(Integer.toString(zipcode) + "\n");


whats the inspector viewer (uiautomatorviewer) on this - can then check the element ids etc

Class for search webelement is “android.widget.EditText” and id is “package name:id/findStore_zipSearch”.

i met with problem that Apple keyboard has different names and get workaround to press LAST key on keyboard which is always some action like Go, Search, Next, Enter … so on

public boolean tapLastKeyboardKey_iOS() {
        List<WebElement> el = driver.findElements(MobileBy.className("UIAKeyboard")).get(0).findElements(MobileBy.className("UIAButton"));
        return tapElement((MobileElement) el.get(el.size() - 1));

where tapElement my own implementation of tap. you can use any yours.

I want to hit search highlighted in red

print here “driver.getPageSource()” result.

How did u find Class name for android keyboard , UI Automator won’t show that .

aaaa Android - then ignore mine post. just give us result of pageSource to see.

Please change to:
//Then insert code to click on the Search Button here

Hopefully it helps you.

Thanks , it worked :slight_smile:

Happy when hearing that. Happy automation testing!

Hi ,

One more question , I don’t want to erase app data for each session , how can i do it in desired capabilities ?