如何使用TestCafe点击父类中的元素



我想在带有父类的文本区域中键入文本,该父类标记在以下img代码段中我想使用那个类,因为textarea上的id是动态元素,每次加载都会更改。这就是我使用父类的原因。我使用

let textArea = Selector('.block-card list-group-item text-card col-xs-12').find('textarea') await t .typeText(textArea, 'Hai...')

但出现错误:

The specified selector does not match any element in the DOM tree.
> | Selector('.block-card list-group-item text-card col-xs-12')
|   .find('textarea')

这是用户界面UI。有人能帮我吗?

这可能适用于

let textArea = Selector('.hwt-container').find('textarea').withAttribute('class','text-card-text')

我会使用Xpath。类似于://div[@class="block-card list-group-item text-card col-xs-12"]//textarea

最新更新