io.appium.java_client.android.nativekey.KeyEvent.withFlag()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.0k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中io.appium.java_client.android.nativekey.KeyEvent.withFlag()方法的一些代码示例,展示了KeyEvent.withFlag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.withFlag()方法的具体详情如下:
包路径:io.appium.java_client.android.nativekey.KeyEvent
类名称:KeyEvent
方法名:withFlag

KeyEvent.withFlag介绍

[英]Adds the flag.
[中]

代码示例

代码示例来源:origin: appium/java-client

@Test
public void pressKeyAndGenerateIMEActionTest() {
  driver.pressKey(new KeyEvent()
      .withKey(AndroidKey.ENTER)
      .withFlag(KeyEventFlag.SOFT_KEYBOARD)
      .withFlag(KeyEventFlag.KEEP_TOUCH_MODE)
      .withFlag(KeyEventFlag.EDITOR_ACTION));
  final String state = driver.findElement(PRESS_RESULT_VIEW).getText();
  // This event won't update the view
  assertTrue(state.isEmpty());
}

代码示例来源:origin: qaprosoft/carina

public static void pressKeyboardKey(AndroidKey key) {
  ((AndroidDriver<?>) getDriver()).pressKey(new KeyEvent(key)
      .withFlag(KeyEventFlag.SOFT_KEYBOARD).withFlag(KeyEventFlag.KEEP_TOUCH_MODE).withFlag(KeyEventFlag.EDITOR_ACTION));
}

相关文章