4

我正在尝试使用 Appium Java 客户端在 testdroid 服务器上自动化我的 android 应用程序测试。在 AndroidElement 上使用 element.sendKeys 时出现无法定位元素的异常。

AndroidElement element = wd.findElement(By.xpath("//android.widget.LinearLayout[1]"
               + "/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]"
               + "/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]"
               + "/android.widget.EditText[1]"));
element.click();
wd.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
element.sendKeys("Hello World");

在上面的代码中 element.sendKeys 抛出异常

找不到元素

看起来它是 sendKey 的“提示文本问题”,但不确定。

请建议我解决方案。

4

1 回答 1

3

对于 android,您应该将功能“unicodeKeyboard”设置为“true”。也不要忘记重置

capabilities.setCapability("unicodeKeyboard", "true");
capabilities.setCapability("resetKeyboard", "true");

参考http://appium.io/slate/en/v1.3.4/?ruby#android-only

于 2015-11-20T06:12:57.337 回答