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

查看:96
本文介绍了搜索键盘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"));

如果这样不起作用,请尝试使用以下命令替换搜索

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天全站免登陆