如何计算TestCafe中以前的兄弟姐妹?

问题描述 投票:0回答:1

摘要:

我正在使用TestCafe,我知道这并不是一个难题(JQuery为此提供了解决方案)。我正在寻找TestCafe中的解决方案。

enter image description here

问题:

我需要知道突出显示的蓝色中有多少个(整数)个先前的同级兄弟(button)。就我而言,答案应该是4。

我到目前为止所做的事情

根据屏幕截图,我在元素索引4中(但我不知道)。我使用了以下选择器来访问元素:

Selector('div.group-name').withExactText('f61ck72g83m')

现在,算一下以前的兄弟姐妹,我尝试过这个:

Selector('div.group-name').withExactText('f61ck72g83m').parent('button.group-info').prevSibling('button').count

这将返回我不想要的承诺:ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null }

testing automation css-selectors testcafe
1个回答
0
投票

我在调用元素之前错过了await。确实是愚蠢的问题。

© www.soinside.com 2019 - 2024. All rights reserved.