UI自动化 - iOS按输入键

时间:2018-06-05 20:57:59

标签: selenium appium-ios

我正在尝试在搜索文本时按下ENTER键自动

public void pressEnter() {
      ((IOSDriver) driver).getKeyboard().sendKeys(Keys.RETURN);
}

尝试自动按Enter键时出现此错误。这有什么不对?这曾经工作过。我也尝试过Keys.ENTER,它也给出了同样的错误。

java-client version:6.0.0

org.openqa.selenium.UnsupportedCommandException: sendKeysToActiveElement
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'USGPSNYCM212943.local', ip: 'fe80:0:0:0:462:ed8d:f2e4:f85d%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.4', java.version: '1.8.0_152-release'
Driver info: driver.version: IOSDriver

    at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:218)
    at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:117)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:152)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:218)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
    at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:35)
    at org.openqa.selenium.remote.RemoteKeyboard.sendKeys(RemoteKeyboard.java:38)
    at com.gpshopper.base.BaseTest.pressEnter(BaseTest.java:98)
    at com.gpshopper.tests.SearchTests.verifySearch_RedirectToDetail(SearchTests.java:97)

1 个答案:

答案 0 :(得分:0)

根据您的要求使用此代码更改,而不是使用“完成输入”

IOSDriver AD =(IOSDriver)驱动程序;
    AD.hideKeyboard(“ PRESS_KEY”,“ Done”);