Not able to click on ImageButton in Android 7.1.1


I am trying to automate an application in which I need to click on the Imagebutton. Even if I enter valid ID, it doesn’t click it and gives me the error that element is not found.

PFA the code and mobile screenshot.

@AndroidFindBy(id = "id = "XXXXXXXXXXXXXXXX:id/img_cardadd")
	private WebElement menu;

public LoginScreen clickMenu(){
		try {
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
		return this;

Here is the error

org.openqa.selenium.NoSuchElementException: Can't locate an element by this strategy: Locator map: - native content: " XXXXXXXXXXXXXXX:id/img_cardadd" - html content: "by id or name "menu"" For documentation on this error, please visit:

Here is the locators

Appium version - 1.6.4
Android OS Version - 7.1.1, Android N
Device - Nexus 5X

replace with:

@AndroidFindBy(id = "img_cardadd")

This didn’t work.

Do I need to run with uiautomator2, since I am using OS 7.1.1? Kindly advise.

you should try cause every android version old automation getting more and more deprecated.

also try instead click():

new TouchAction((MobileDriver) driver).press(menu).waitAction(Duration.ofMillis(70)).release().perform();

Sorry, this also didn’t work.

Also I am getting error for element not found, so I guess, element is not found then this touch will also not work.

@mashkurm one more. do you initiate your page elements with appium decorator? (just fore sure)

No… But this tests are working fine with my lower end devices (I checked with Nexus 5 having osV5.0.1)…

Try like
Point P=element.getCenter()
tap(p.getx(), p.gety());

Hello Kishore, your solution will work only if I can able to find the element…

In this case, I am not able to locate the element, then how will I get x and y co-ordinates for the same? I asked question to find the element not to click on the element… Let me know if I am missing something.


Even i am facing this kind of issues, some time i am supposed to app switch button and click the app… not sure what is the logic.

Are you able to click that element through Appium inspector, else try with Xpath.

Hi mashkurm,
Did you get any solution for this ?

Hi @Kishore_v, I am now running this on lower end devices (os<5), didn’t get time to investigate further.