【发布时间】:2021-04-14 17:24:42
【问题描述】:
我想通过script() 函数获取一个元素,但我想使用我在 XPath 中定义的变量。知道这是如何工作的吗?
我使用的是空手道 1.0.1。
* def username = __arg.username
* print 'username:', username
* def listRowElement = script("//div[@aria-colindex='1' and text()='"+username+"']", '_.textContent')
* mouse().move(listRowElement).click()
如果我只输入用户名就可以了,但我希望它可以重复使用。
提前感谢您的意见。
【问题讨论】:
标签: karate