简体   繁体   English

如何在模拟器上使用Appium自动化android手机后退按钮

[英]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). 我最近开始使用Appium(java客户端库)为Android上的本机移动应用程序进行测试自动化。 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 appium java 客户端 6.1.0 自动化 Android 手机底部的 Home、back、up、down、Menu 按钮? - How to automate Home,back,up,down,Menu button at bottom of Android phone using appium java client 6.1.0? 如何用Appium双击android后退按钮? - How to double click android back button with Appium? 用Eclipse编写的Java代码不能与TESTNG一起运行(尝试使用Eclipse和Appium for Android Emulator自动化测试) - Java code written in Eclipse did not run with TESTNG (trying to automate test using Eclipse and Appium for Android Emulator) 如何使用 Appium Java 在 Android 5.0 上自动化时间选择器 - How to Automate Time Picker on Android 5.0 using Appium Java 如何使用appium自动化/测试Android混合应用程序? - how to Automate/test Android hybrid apps using appium? 如何使用Appium同时自动化两个Android应用程序? - How to automate two android app simultaneously using Appium? 如何在Java中创建一个appium android设备“后退按钮” - How to create an appium android device “back button” in java Appium-Java,如何在android中自动滑动? - Appium - Java, How to automate swipe in android? 如何使用手机的后退按钮和创建的后退按钮终止音乐? - How to terminate music using back button of phone and created back button? 使用Appium脚本自动化Android模拟器和浏览器 - Automating android emulator and browser using Appium script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM