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

Karate 空手道UI:使用waitFor()中的变量检查UI测试中的元素,karate,ui-testing,Karate,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()函数中使用变量?是的,这

我正在尝试使用空手道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)