首页 > 解决方案 > Selector 的调试值

问题描述

也许是一个简单的问题,但我自己完全无法解决。

如何调试/输出选择器的值?

await t
            .expect(Selector('.progress-bar.progress-bar-success').getStyleProperty('width')).eql('100%', {timeout: 90000})

我试着用

console.log(Selector('.progress-bar.progress-bar-success').getStyleProperty('width'));

最后还有 .value 。但我没有得到任何信息。有小费吗?

标签: debuggingtestingcss-selectorsselectortestcafe

解决方案


选择器返回一个 Promise。您需要等到承诺得到解决。为此,只需await在 Selector 调用之前添加关键字。

console.log(await Selector('.progress-bar.progress-bar-success').getStyleProperty('width'));

推荐阅读