Appium Java客户端按键方法工作正常,但在移动设备中没有按键?

Appium Java客户端按键方法工作正常,但在移动设备中没有按键?,appium,java-client,Appium,Java Client,我的自动化框架中有以下代码片段 public void settings() { try { //((AndroidDriver) Driver).pressKeyCode(AndroidKeyCode.SETTINGS); ((AndroidDriver) Driver).pressKey(new KeyEvent(AndroidKey.SETTINGS)); updateTestLog(Action,

我的自动化框架中有以下代码片段

 public void settings() {
        try {
            //((AndroidDriver) Driver).pressKeyCode(AndroidKeyCode.SETTINGS);
            ((AndroidDriver) Driver).pressKey(new KeyEvent(AndroidKey.SETTINGS));
            updateTestLog(Action, "settings pressed", Status.PASS);
        } catch (Exception ex) {
            updateTestLog(Action, ex.getMessage(), Status.DEBUG);
            Logger.getLogger(KeyActions.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
我已经连接了手机,看看它是否工作正常。在Appium服务器中,日志跟踪显示密钥代码176设置工作正常。但在手机屏幕上没有动作

我试过不同的键,如菜单,主页,搜索和进入。我看到它在移动设备中运行良好。

如果需要打开,我相信最好的选择是调用如下函数:

((AndroidDriver) driver).startActivity(new io.appium.java_client.android.Activity("com.android.settings",".Settings"));
如果您正在寻找跨平台解决方案,那么通过