问题描述
Api返回一个confirmationNumber,我将其存储在变量中,然后使用该confirmationNumber单击并在UI页面上进行断言.
Api returns a confirmationNumber, which i'm storing in a variable then using that confirmationNumber to click and assert on the UI page.
- def myFeature =调用read('Feature1.feature')
- def确认号= myFeature.confirmationNumber
//一些ui登录步骤在这里
//some ui login steps are here
然后输入('#paymentNum',confirmationNumber)//-成功输入的confirmationNumber
Then input('#paymentNum',confirmationNumber) //--successfully entered confirmationNumber
然后断言存在('{div} confirmationNumber').//- 不成功.无法读取存储的值
And assert exists('{div}confirmationNumber'). //--not successful. not able to read the stored value
然后单击('{a} confirmationNumber')//-不成功.无法读取存储的值
And click('{a}confirmationNumber') //--not successful. not able to read the stored value
请帮助谢谢
推荐答案
简单.将(
和)
中的所有内容都视为纯JavaScript.另外请注意额外的 exists
,嗯,也许我应该重新设计API的这一部分-感谢您提出这个问题! https://github.com/intuit/karate/issues/1148
Easy. Think of anything within the (
and )
as pure JavaScript. Also please note the extra exists
, hmm maybe I should re-design that part of the API - and thanks for asking this question ! https://github.com/intuit/karate/issues/1148
# this is how to use exists() right now, but I have decided to change this !
And assert exists('{div}' + confirmationNumber).exists
And click('{a}' + confirmationNumber)
这篇关于空手道用户界面:如何将动态值传递给定位符和断言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!