空手道在本地存储中设置令牌

Karate set token in local storage

我可以使用以下脚本在本地存储中设置一些值

但是我需要设置item传参

例如,

保存来自 api 调用的响应令牌

现在我想将此令牌保存到会话存储中。如何做到这一点?

完全由您通过字符串连接创建一些有效的 JS。

例如:

* def temp = "sessionStorage.setItem('foo', '" + response.token + "')"
* script(temp)

另请阅读文档的这一部分:https://github.com/intuit/karate/tree/master/karate-core#karate-vs-the-browser