【问题标题】:Karate Mobile - Is there a way in Karate to perform TouchActions or scrollIntoView空手道移动 - 空手道有没有办法执行 TouchActions 或 scrollIntoView
【发布时间】:2020-06-30 11:56:31
【问题描述】:

我们正在探索用于移动 APP 测试的空手道。在应用程序的某些部分,我们需要滚动下拉选择选项或需要使用 TouchActions 来按下返回按钮。空手道有没有办法实现 TouchActions 或 scrollIntoView。

谢谢, 谢卡尔

【问题讨论】:

    标签: karate


    【解决方案1】:

    此时不支持TouchActions,但mobile commands 应该在develop 分支中工作。

    请求您查看 https://github.com/intuit/karate/wiki/Developer-Guide 以构建它并验证它是否工作或应该在下一个 RC 构建中可用 0.9.6.RC4

    使用移动命令滚动:

    script("mobile: scroll", {direction: 'down'} )
    

    由于您没有提到它是Android 还是iOS,如果这适用于您的驱动程序类型,请参考移动命令页面

    【讨论】:

    • 我已按照您在上面提供的步骤进行操作,但是我收到错误消息,以下是详细信息。
    • 我已按照您在上面提供的步骤进行操作,但是我收到错误消息,以下是详细信息。 Testing on android version 9.0 emulator appium version :- 1.17.1 command :- script("mobile:scroll",{strategy : '-android uiautomator' , selector : "-android.widget.TextView[text='Argentina']"})Error:- "Unknown mobile command \"scroll\". Only shell,scrollBackTo,viewportScreenshot,deepLink,startLogsBroadcast,stopLogsBroadcast,acceptAlert,dismissAlert,batteryInfo,deviceInfo,...
    • 我在这里也看到了同样的错误github.com/appium/ruby_lib/issues/867 我尝试了命令 deviceInfo,batteryInfo 工作正常。
    • 好的,所以你在Android :(。可以使用此解决方法调用未实现的驱动程序函数https://github.com/intuit/karate/tree/develop/examples/ui-test#webdriver-tips .. 检查这是否有帮助。否则您可能必须等到karate 中的实现已准备就绪
    • github.com/intuit/karate/issues/1686
    【解决方案2】:

    谢谢巴布 如果我们使用如下的 driver.script 就可以了;

    driver.script("mobile: scroll", { "strategy" : "accessibility id", "selector": "Lists"}) “列表”在这里是它的定位器。 唯一的限制是在此滚动中使用有限的选择器支持。

    Android 你只能使用:accessibility id, class name, -android uiautomator iOS 你只能使用:predicateString

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 2023-02-02
      相关资源
      最近更新 更多