打印当前 DOM 元素
Print current DOM element
我正在尝试 select 基于兄弟元素的元素,类似于 this post。但是,我得到一个错误 The specified selector does not match any element in the DOM tree.
,这意味着 testcafe 没有找到我的元素。
为了帮助调试,如果我可以打印 Selector()
当前正在读取的 DOM 元素就好了。
使用console.log(Selector('element'))
打印出对象。有没有办法输出当前的DOM元素?
您可以输出 DOM Node Snapshot 中的任意 属性。
例如
console.log(await Selector('element').innerText);
console.log(await Selector('element').value);
我正在尝试 select 基于兄弟元素的元素,类似于 this post。但是,我得到一个错误 The specified selector does not match any element in the DOM tree.
,这意味着 testcafe 没有找到我的元素。
为了帮助调试,如果我可以打印 Selector()
当前正在读取的 DOM 元素就好了。
使用console.log(Selector('element'))
打印出对象。有没有办法输出当前的DOM元素?
您可以输出 DOM Node Snapshot 中的任意 属性。
例如
console.log(await Selector('element').innerText);
console.log(await Selector('element').value);