空手道-UI:在 waitFor() 中使用变量检查 UI 测试中的元素

Karate-UI: Using a variable in waitFor() to check the element in UI testing

我正在尝试通过空手道 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() 函数中使用变量?

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

Then waitFor('{}' + testName)