搜索键盘 Appium Java 不起作用 [英] Search keyboard Appium Java not function

查看:42
本文介绍了搜索键盘 Appium Java 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试为该主题找到解决方案,所有网站的答案都不会帮助我,

try to find a solution for this topic and none of the answers all the websites won't help me,

搜索键盘 Appium Java 没有功能

Search keyboard Appium Java not function

没有帮助的代码示例:

((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.ENTER));

同:

driver.sendKeyEvent(AndroidKeyCode.ENTER);

或:

((AndroidDriver)driver).pressKeyCode(66)

或:

((AndroidDriver)driver).pressKeyCode(84)

我正在使用这个 appium 版本:

I'm using this appium version:

<dependency>
    <groupId>io.appium</groupId>
    <artifactId>java-client</artifactId>
    <version>6.1.0</version>
</dependency>

这个选项是通过坐标来做的,对我来说不是解决方法,因为这个测试是用真实的手机和任何具有不同屏幕尺寸分辨率的手机完成的

the option do it via coordinates not workaround for me since this tests done with a real mobiles and any mobile with a different screen size resolution

共享异常和堆栈跟踪

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'Haims-MacBook', ip: 'fe80:0:0:0:8ea:4c20:85c7:1988%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_112'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: net.XXX.XXX.ui.acti..., appPackage: net.XXX.XXX.qa, databaseEnabled: false, desired: {appActivity: net.XXX.XXX.ui.acti..., appPackage: net.XXX.XXX.qa, deviceName: Galaxy A20, noReset: false, platformName: android, platformVersion: 9}, deviceManufacturer: samsung, deviceModel: SM-A205FN, deviceName: R58M50DVABW, deviceScreenSize: 720x1560, deviceUDID: R58M50DVABW, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: false, platform: LINUX, platformName: Android, platformVersion: 9, takesScreenshot: true, warnings: {}, webStorageEnabled: false}
Session ID: ad88e2fa-102c-4e19-b8fa-ac48054838ff

推荐答案

您可以使用以下代码按搜索按钮.

You can use below code to press search button.

((JavascriptExecutor) driver).executeScript("mobile: performEditorAction", ImmutableMap.of("action", "search"));

如果这不起作用,请尝试用以下命令替换 search

If this doesn't work try replacing search with below commands

  1. 发送
  2. 下一个
  3. 完成

此外,如果这不起作用,请尝试在执行此命令之前延迟 1 或 2 秒.有关更多信息,您可以参考http://appium.io/docs/en/commands/mobile-command/

Also, if this doesn't work try giving 1 or 2 sec delay before the execution of this command. For more information you can refer http://appium.io/docs/en/commands/mobile-command/

这篇关于搜索键盘 Appium Java 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆