简体   繁体   English

如何使用Selenium,Android和C#单击设备后退按钮

[英]How to click device back button using Selenium, android and C#

在此处输入图片说明 I am presently running an automation script, I want to click on the device back button, though I have used this snippet driver.Navigation().back() previously that worked for clicking app back button. 我目前正在运行一个自动化脚本,我想单击设备后退按钮,尽管我以前曾使用此代码段driver.Navigation().back()曾用于单击应用程序后退按钮。 how do click that of the device? 如何单击设备的那个?

please try below code 请尝试下面的代码

 driver.pressKeyCode(AndroidKeyCode.BACK); // it will android device back button 

if you want to perform any other operation with android device keys you can use same approach.You will get keys in AndroidKeyCode . 如果您想使用android设备密钥执行任何其他操作,则可以使用相同的方法。您将在AndroidKeyCode中获取密钥。

hope these helps you. 希望这些对您有所帮助。

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

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