Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Karate 空手道UI:使用waitFor()中的变量检查UI测试中的元素_Karate_Ui Testing - Fatal编程技术网

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)