【问题标题】:Karate-UI: Using a variable in waitFor() to check the element in UI testingKarate-UI:使用 waitFor() 中的变量来检查 UI 测试中的元素
【发布时间】:2020-05-07 11:49:21
【问题描述】:

我正在尝试通过 Karate v0.9.5 进行 UI 测试
就我而言,我使用这样的 waitFor() 函数

* def testName = 'name_' + (int)(Math.random()*100)
And input('input[name=title]', testName)
When click('{button/span}Add')
Then waitFor('{}#(testName)')

它会将#(testName) 检测为字符串
有什么方法可以在 waitFor() 函数中使用变量吗?

【问题讨论】:

    标签: karate ui-testing


    【解决方案1】:

    是的,这是最简单的方法。 ( ) 中的任何内容都被视为纯 JavaScript。

    Then waitFor('{}' + testName)
    

    【讨论】:

      猜你喜欢
      • 2012-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多