I'm writing some QA tests for android and faced with an issue that none of the known methods for pressing 'Home' button work. I want to mention that I use AppiumDriver
, not AndroidDriver
.
((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.HOME);
- this one doesn't work driver.pressKeyCode(AndroidKeyCode.HOME);
- doesn't work either
Is there any method to press android button in 2020?
Well if you want to send an app in background then simply use
`driver.CloseApp()`
function and relaunch it by
driver.OpenApp()
You can also use press keycode method Below are the codes
Home Menu Button - 82
Back Button - 4
Recent app - 187
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.