How to disable the soft keys menu in android while running automation?


How to disable the soft keys menu in android while running automation? I mean the Home, Back soft keys appear on the bottom of the screen.

The issue is when trying to click an element at the bottom of the screen, instead of clicking on an expected element, the softkeys suddenly appeared and received a click. So I just want to disable those soft keys menu while running the automation to avoid unwanted test failures. Is there any workaround to solve this in Appium?

I’ve attached the sample image of softkeys.


@mykola-mokhnach Is there any way to solve this?




Okay let me try. Thanks!


Thanks @mykola-mokhnach Those ADB commands are working fine.

To disable soft keys:
adb shell wm overscan 0,0,0,-202

To enable soft keys again:
adb shell wm overscan 0,0,0,0


@mykola-mokhnach I’ve used the above ADB commands to enable/disable soft keys. The soft keys are invisible now. But still I can’t able to click the element at the bottom of the screen. I just checked in the UIAutomator viewer. Whatever the screen I’ve captured in uiautomator viewer, the element at the bottom has not covered in the screenshot. I mean, I can’t able to select the element in uiautomator viewer. So I guessed and it seemed like even after disabling the soft keys from screen, the softkeys are present and occupy the bottom of the screen in a invisible manner and that soft keys alone received a click in automation instead a element.

Is there a way to disable it permanently from screen? Actually these problem may occur in all latest android devices which are capable of using soft keys.

Kindly let me know your thoughts here.


The following issue is same as what I’ve raised here. Someone said, the problem with clicking was mitigated by enabling the navigation bar.

I just tried the following ABD command only, for enabling the navigation bar. But no luck again, the click is not happening on the expected element at the bottom. Can you take a look into the below github link and let me know what he was tried to solve this issue.

adb shell wm overscan 0,0,0,0


I cannot help much with that. This seems to be an issue with UIA framework itself.


This issue has been resolved after started using uiautomator2.

Added the following the capability:

capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);