Application Not Closing in Android

Hi Guys

I want to close Application in end of tests

I will Try with CloseApp , Quit , terminateApp , adb shell am force-stop «app_package»
but its still running in background

does not close completely
If I press the home button on the device, the app is still there

Why ? we have more solution ?


you can try set fullReset capability to true.

Thanks @ido_oserovitz
but its not option for me :pensive:
i cant remove Application from device
i need just close


Thanks @mykola-mokhnach
So right now
We don’t have a solution that completely closes the app
Right ?


The app is closed. If you’d like to ask if there is a solution to remove recent app previews then the answer is “no”.

Thanks @mykola-mokhnach

I found a nice solution that works great :slight_smile:
we can click on recent app , and click on clear all button
driver.pressKey(new KeyEvent().withKey(AndroidKey.APP_SWITCH));
I used the position of the button
Because it does not recognize the element

TouchAction touchAction = new TouchAction(driver);
touchAction.tap(PointOption.point(x, y)).perform();



1 Like