G-k*_*key 5 testing automated-tests filter e2e-testing testcafe
我正在尝试使用withText过滤器创建一个选择器并希望选择同级元素。
给出: const Create_asset = S('span').withText('Create Asset')
Create_asset()ReExecutablePromise用nextSibling()方法返回一个。
await Create_asset()返回一个 DOM-like(?) 对象,但没有nextSibling()方法,所以我似乎做不到await Create_asset().withText('text').nextSibling()
使用withText()过滤器时如何随后选择兄弟姐妹?
也感谢您提供任何调试技巧!
下面的代码返回一个DOM 节点快照。
const mySelector = Selector('span').withText('text');
const snapshot = await mySelector();
Run Code Online (Sandbox Code Playgroud)
在您的测试场景中,您可以执行以下操作:
await t
.expect(mySelector.withText('some text').nextSibling().getAttribute('id')).eql('id1');
Run Code Online (Sandbox Code Playgroud)
注意:TestCafe 允许您调试服务器端测试代码并在客户端测试行为
| 归档时间: |
|
| 查看次数: |
1154 次 |
| 最近记录: |