简体   繁体   中英

How to automate the android phone back button using appium on emulator

I have recently started working on test automation for a native mobile application on Android using Appium(java client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried following code,

driver.sendKeyEvent(AndroidKeyCode.BACK);

by checking other posts, but it did not work for me. Can anyone suggest a solution?

您需要使用以下代码返回。

driver.pressKeyCode(AndroidKeyCode.BACK);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM