Selector 的调试值

ing*_*ngo 2 testing debugging css-selectors selector testcafe

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

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

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

我试着用

console.log(Selector('.progress-bar.progress-bar-success').getStyleProperty('width'));
Run Code Online (Sandbox Code Playgroud)

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

mlo*_*sev 5

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

console.log(await Selector('.progress-bar.progress-bar-success').getStyleProperty('width'));
Run Code Online (Sandbox Code Playgroud)